question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SvelteKit v1.0.0-next.304 is suddenly executing code during build, prerender problem?

See original GitHub issue

Describe the bug

I am building a full stack SvelteKit adapter-node application with database connection. It is build in a container to be run in a container. Todays npm update killed my build process because npm run build started to execute my source code.

So far this would build, but with SvelteKit v1.0.0-next.304 (and its dependencies) build started to fail:

// hooks.ts
export const handle = async ({ event, resolve }) => {
	// simulate crash because DB can not be connected 
        // without credentials and access during build process
	console.log('Going to simulate crash')
	process.exit();

	const response = await resolve(event);
	return response;
};

My last good npm update was 3 days ago.

Note: The build process always worked, but I had to use npm ci --production --ignore-scripts later with the built code.

This may have to do with the pre-rendering, but I have not touched those settings.

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-9crzvj?file=src%2Fhooks.js

const config = {
	kit: {
		prerender: {
			enabled: false
		}
	}
}

Run npm run build and it will execute the code and exit the process

Logs

No response

System Info

WORKS

  System:
    OS: macOS 12.2.1
    CPU: (8) arm64 Apple M1
    Memory: 105.05 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.19.0 - /opt/homebrew/opt/node@14/bin/node
    npm: 6.14.16 - /opt/homebrew/opt/node@14/bin/npm
  Browsers:
    Chrome: 100.0.4896.60
    Firefox: 98.0.2
    Safari: 15.3
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.0-next.33 => 1.0.0-next.33
    @sveltejs/adapter-node: ^1.0.0-next.73 => 1.0.0-next.73
    @sveltejs/kit: ^1.0.0-next.303 => 1.0.0-next.303
    svelte: ^3.46.0 => 3.46.4

WORKS NOT ANYMORE

  npmPackages:
    @sveltejs/adapter-auto: ^1.0.0-next.34 => 1.0.0-next.34
    @sveltejs/adapter-node: ^1.0.0-next.73 => 1.0.0-next.73
    @sveltejs/kit: ^1.0.0-next.304 => 1.0.0-next.304
    svelte: ^3.46.6 => 3.46.6

Severity

blocking an upgrade

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:10
  • Comments:33 (24 by maintainers)

github_iconTop GitHub Comments

6reactions
mrkishicommented, Apr 3, 2022

Bugs eventually squeeze in unnoticed, and being on the @next edge of a fast-changing prerelease library means you’ll eventually hit them. We welcome collaboration on getting things fixed, but pointing out how obvious a bug is from your perspective doesn’t help anyone.

I’m bumping this to p0-urgent, but please let’s strive to keep the discussion constructive—adding a thumbs up to the issue is enough to signal you were (unfortunately) affected by it.

6reactions
ponderingexistencecommented, Apr 3, 2022

By the way, I think the p0-urgent label is more appropriate for this. It’s breaking a lot of people’s stuff.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vite fails to build sveltekit app, returns exit code 1 during ...
So when I run npm run build --debug (using vite), I get the error: [vite-plugin-svelte-kit] Prerendering failed with code 1 error during ...
Read more >
Let's learn SvelteKit by building a static Markdown blog ...
To generate a new SvelteKit project, run this in your terminal ... svelte-preprocess automatically transforms the code in your Svelte ...
Read more >
Kit is prerendering an endpoint on build, I feel like I have ...
My project is using Netlify through the auto adapter and is using v1.0.0-next.308. It has a mixture of routes that I want to...
Read more >
Connect your content to SvelteKit
In this guide, you will add the necessary code to a SvelteKit starter to pull in your content from your Sanity Content Lake....
Read more >
sveltejs/kit NPM
The fastest way to build Svelte apps ... This is the SvelteKit framework and CLI. ... See the documentation to learn more. Changelog....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found