Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prerender triggered, even when specified to disable #8436

Closed
gbkwiatt opened this issue Jan 10, 2023 · 3 comments
Closed

Prerender triggered, even when specified to disable #8436

gbkwiatt opened this issue Jan 10, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@gbkwiatt
Copy link
Contributor

Describe the bug

After updating to version when config.kit.prerender.enabled param was removed and you have to specify either on layout or on +server.js files to disable prerender - I can't build with build-node since it fails because there is some ENV not present (which is true, they are not present at the build run, but they are later). But on previous versions it builds fine and doesn't try to prerender

Error I am getting

    throw new Error("Missing Env Variable SOME_TOKEN");
          ^

Error: Missing Env Variable SOME_TOKEN
    at createClient (file:///home/gbkwiatt/prerender-test/.svelte-kit/output/server/entries/endpoints/server_side/_server.js:5:11)
    at file:///home/gbkwiatt/prerender-test/.svelte-kit/output/server/entries/endpoints/server_side/_server.js:2:1
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:409:24)
    at async prerender (file:///home/gbkwiatt/prerender-test/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:372:16)

which it comes from prerender but it should not even try to prerender ? What did I miss during migration ?

Reproduction

here is reproduction, just run npm run build
https://github.com/gbkwiatt/sveltekit-prerender-test

Logs

No response

System Info

System:
    OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
    Memory: 1.97 GB / 9.72 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 18.1.0 - ~/.nvm/versions/node/v18.1.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.1.0/bin/yarn
    npm: 8.8.0 - ~/.nvm/versions/node/v18.1.0/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.0 => 1.0.0 
    @sveltejs/adapter-node: ^1.1.0 => 1.1.0 
    @sveltejs/kit: ^1.0.0 => 1.0.11 
    svelte: ^3.54.0 => 3.55.0 
    vite: ^4.0.0 => 4.0.4

Severity

annoyance

Additional Information

No response

@dummdidumm
Copy link
Member

This is expected behavior as of #7762 which also contains some tips on how to keep your code running (using the building boolean to guard against executing that code). Giving this the documentation label since this is currently only documented on the building boolean and it's probably good to have it mentioned somewhere else, too.

@dummdidumm dummdidumm added the documentation Improvements or additions to documentation label Jan 10, 2023
@LegendTomaszKwiatkowski

Ahh.... well that works now when guarding the code. Thanks

@dummdidumm dummdidumm mentioned this issue Jan 13, 2023
5 tasks
@dummdidumm
Copy link
Member

This is now covered in https://kit.svelte.dev/docs/building-your-app and the logs during building also give a more clear status on what's currently happening ("analysing routes" etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants