Skip to content

while build newer SvelteKit runs the init: ServerInit function from hooks.server.ts #14347

@1muen

Description

@1muen

Describe the bug

I noticed the builds failing because on our CI server we dont have the environment variables we check for in our init: ServerInit function.
Earlier versions like "@sveltejs/kit": "2.26.1", dont have that bug.

Reproduction

https://github.com/1muen/sv-build-bug-example/tree/buildFails

Logs

❯ pnpm run build

> [email protected] build /home/lmuen/github/sv-bug-example
> vite build

vite v7.1.3 building SSR bundle for production...
✓ 175 modules transformed.
vite v7.1.3 building for production...
✓ 142 modules transformed.
.svelte-kit/output/client/_app/version.json                        0.03 kB │ gzip:  0.05 kB
.svelte-kit/output/client/.vite/manifest.json                      2.66 kB │ gzip:  0.53 kB
.svelte-kit/output/client/_app/immutable/chunks/Cn8smvWX.js        0.04 kB │ gzip:  0.06 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.qYLW-IHu.js   0.08 kB │ gzip:  0.09 kB
.svelte-kit/output/client/_app/immutable/nodes/0.D3vBsTvv.js       0.21 kB │ gzip:  0.17 kB
.svelte-kit/output/client/_app/immutable/nodes/2.BpvxDwus.js       0.32 kB │ gzip:  0.24 kB
.svelte-kit/output/client/_app/immutable/chunks/CWdd3wXn.js        0.41 kB │ gzip:  0.29 kB
.svelte-kit/output/client/_app/immutable/nodes/1.BQ1_4Lna.js       1.01 kB │ gzip:  0.58 kB
.svelte-kit/output/client/_app/immutable/chunks/99wAdZLI.js        3.78 kB │ gzip:  2.01 kB
.svelte-kit/output/client/_app/immutable/entry/app.14EI74m7.js     7.30 kB │ gzip:  3.46 kB
.svelte-kit/output/client/_app/immutable/chunks/Dv8ZI-4E.js       20.30 kB │ gzip:  8.08 kB
.svelte-kit/output/client/_app/immutable/chunks/CS2OvKfn.js       31.91 kB │ gzip: 12.52 kB
✓ built in 495ms
✗ Build failed in 1.52s
error during build:
[vite-plugin-sveltekit-compile] Failed with code 1
    at Worker.<anonymous> (file:///home/lmuen/github/sv-bug-example/node_modules/@sveltejs/kit/src/utils/fork.js:65:13)
    at Worker.emit (node:events:518:28)
    at [kOnExit] (node:internal/worker:315:10)
    at Worker.<computed>.onexit (node:internal/worker:229:20)
 ELIFECYCLE  Command failed with exit code 1.

System Info

System:
    OS: Linux cpe:/o:nixos:nixos:25.11 25.11 (Xantusia)
    Container: Yes
    Shell: 4.0.2 - /run/current-system/sw/bin/fish
  Binaries:
    Node: 22.18.0 - /run/current-system/sw/bin/node
    Yarn: 1.22.22 - /run/current-system/sw/bin/yarn
    npm: 10.9.3 - /run/current-system/sw/bin/npm
    pnpm: 10.15.0 - /run/current-system/sw/bin/pnpm
    bun: 1.2.20 - /run/current-system/sw/bin/bun
  npmPackages:
    @sveltejs/adapter-auto: 6.1.0 => 6.1.0 
    @sveltejs/adapter-node: 5.3.1 => 5.3.1 
    @sveltejs/kit: 2.37.0 => 2.37.0 
    @sveltejs/vite-plugin-svelte: 6.1.3 => 6.1.3 
    svelte: 5.38.6 => 5.38.6 
    vite: 7.1.3 => 7.1.3

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions