-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Description
Describe the bug
Hi, I just made a static site and set config,kit.prerender.handleHttpError according to the docs. However, the build command takes a lot of time and then just exits with an error (see logs below)
Reproduction
in the root +layout.svelte, add the following:
<svelte:head>
<meta property="og:title" content={dynamic_title} />
<meta property="og:description" content={dynamic_desc} />
<meta property="og:url" content={page.url.origin} />
<meta property="og:image" content="{page.url.host}/{a_path_to_svelte_kit_static_content}" />
</svelte:head>Then, my config looks just like this:
const config = {
preprocess: vitePreprocess(),
kit: {
adapter: static_adapter({
precompress: true
}),
prerender: {
handleHttpError: (det) => {
const { status, message } = det;
console.log(`error from svelte.config.js -> config.kit.prerender.handleHttpError(): \n`);
console.log(inspect(det, true, null, true));
if (status >= 400 && status < 500) {
return 'warn';
}
throw new Error(message);
}
}
}
};Logs
after running `pnpm build`, output looks like this:
vite v7.1.7 building SSR bundle for production...
✓ 213 modules transformed.
vite v7.1.7 building for production...
✓ 161 modules transformed.
.svelte-kit/output/client/_app/version.json 0.03 kB │ gzip: 0.05 kB
.svelte-kit/output/client/.vite/manifest.json 3.61 kB │ gzip: 0.72 kB
.svelte-kit/output/client/_app/immutable/assets/2.DSfxk8o2.css 1.50 kB │ gzip: 0.57 kB
.svelte-kit/output/client/_app/immutable/assets/0.CMpaBS7g.css 41.20 kB │ gzip: 7.82 kB
.svelte-kit/output/client/_app/immutable/chunks/DsnmJJEf.js 0.07 kB │ gzip: 0.08 kB
.svelte-kit/output/client/_app/immutable/entry/start.RRW9TG_7.js 0.08 kB │ gzip: 0.09 kB
.svelte-kit/output/client/_app/immutable/chunks/c7DZMM8V.js 0.18 kB │ gzip: 0.14 kB
.svelte-kit/output/client/_app/immutable/chunks/50G2RjtE.js 0.30 kB │ gzip: 0.22 kB
.svelte-kit/output/client/_app/immutable/nodes/1.mwG7EJ2z.js 0.42 kB │ gzip: 0.29 kB
.svelte-kit/output/client/_app/immutable/chunks/L6wIdL0K.js 0.45 kB │ gzip: 0.31 kB
.svelte-kit/output/client/_app/immutable/chunks/N9lAo_Pj.js 0.52 kB │ gzip: 0.33 kB
.svelte-kit/output/client/_app/immutable/nodes/0.CnpseRnQ.js 1.92 kB │ gzip: 0.94 kB
.svelte-kit/output/client/_app/immutable/chunks/CwY099cG.js 2.15 kB │ gzip: 1.15 kB
.svelte-kit/output/client/_app/immutable/entry/app.CbiFaNZM.js 5.62 kB │ gzip: 2.70 kB
.svelte-kit/output/client/_app/immutable/chunks/L23dAPVL.js 8.85 kB │ gzip: 4.17 kB
.svelte-kit/output/client/_app/immutable/chunks/KPqfODo3.js 29.39 kB │ gzip: 11.59 kB
.svelte-kit/output/client/_app/immutable/chunks/Ccp16_zV.js 31.71 kB │ gzip: 12.38 kB
.svelte-kit/output/client/_app/immutable/nodes/2.u4DBBnek.js 41.27 kB │ gzip: 15.74 kB
✓ built in 579ms
SvelteKitError: Not found: /sveltekit-prerender//me.jpg
...
at AsyncLocalStorage.run (node:internal/async_local_storage/async_context_frame:63:14) {
[stack]: [Getter/Setter],
[message]: 'Not found: /sveltekit-prerender//me.jpg',
status: 404,
text: 'Not Found'
}
node:events:485
throw er; // Unhandled 'error' event
^
Error [ERR_WORKER_OUT_OF_MEMORY]: Worker terminated due to reaching memory limit: JS heap out of memory
at [kOnExit] (node:internal/worker:314:26)
at Worker.<computed>.onexit (node:internal/worker:230:20)
Emitted 'error' event on Worker instance at:
at [kOnExit] (node:internal/worker:314:12)
at Worker.<computed>.onexit (node:internal/worker:230:20) {
code: 'ERR_WORKER_OUT_OF_MEMORY'
}
Node.js v24.5.0System Info
OS: Manjaro Linux x86_64
Kernel: Linux 6.12.48-1-MANJARO
Node: v24.5.0Severity
serious, but I can work around it
Additional Information
No response
Copilot