sveltejs / sveltejs/kit

Attempting to use a constant `prerender` remote function in the inputs for another causes confusing internal error

Open
#16,756 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug

Using a prerender function in the inputs for another prerender remote function results in the following output while building:

[… other content]
✓ built in 142ms

node:internal/event_target:1136
  process.nextTick(() => { throw err; });
                           ^
Error: Could not get the request store. This is an internal error.
    at get_request_store (file:///Users/belcar/Developer/site/web/node_modules/@sveltejs/kit/src/exports/internal/event.js:60:9)
    at wrapper (file:///Users/belcar/Developer/site/web/.svelte-kit/output/server/chunks/remote.js:548:28)
    at Object.inputs (file:///Users/belcar/Developer/site/web/.svelte-kit/output/server/chunks/words.remote.js:140:44)
    at prerender (file:///Users/belcar/Developer/site/web/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:582:47)
    at async MessagePort.<anonymous> (file:///Users/belcar/Developer/site/web/node_modules/@sveltejs/kit/src/utils/fork.js:23:16)

Node.js v26.7.0
error: script "build" exited with code 1

But this output doesn't give the user information on what the issue is with their code, what remote function is involved, or even that remote functions are related in the first place.

Reproduction

https://github.com/dontwanttothink/sveltekit-repro-1

Logs
❯ bun run build
$ vite build
vite v8.2.1 building ssr environment for production...
✓ 151 modules transformed.
vite v8.2.1 building client environment for production...
✓ 179 modules transformed.
computing gzip size...
.svelte-kit/output/client/_app/version.json                        0.02 kB │ gzip:  0.04 kB
.svelte-kit/output/client/.vite/manifest.json                      2.33 kB │ gzip:  0.47 kB
.svelte-kit/output/client/_app/immutable/entry/start.C36RKQEm.js   0.08 kB │ gzip:  0.09 kB
.svelte-kit/output/client/_app/immutable/chunks/CtAviEmz.js        0.10 kB │ gzip:  0.11 kB
.svelte-kit/output/client/_app/immutable/nodes/1.CTHoodbh.js       0.62 kB │ gzip:  0.35 kB
.svelte-kit/output/client/_app/immutable/chunks/Bjy-W4x2.js        1.36 kB │ gzip:  0.65 kB
.svelte-kit/output/client/_app/immutable/nodes/0.DU7JnLqT.js       2.41 kB │ gzip:  0.99 kB
.svelte-kit/output/client/_app/immutable/entry/app.BrBw-1kf.js     3.94 kB │ gzip:  1.82 kB
.svelte-kit/output/client/_app/immutable/nodes/2.BSXvwi3D.js       6.67 kB │ gzip:  2.77 kB
.svelte-kit/output/client/_app/immutable/chunks/BWUUmqeS.js       35.94 kB │ gzip: 13.56 kB
.svelte-kit/output/client/_app/immutable/chunks/Do16MpR0.js       43.43 kB │ gzip: 16.61 kB

✓ built in 108ms

node:internal/event_target:1136
  process.nextTick(() => { throw err; });
                           ^
Error: Could not get the request store. This is an internal error.
    at get_request_store (file:///Users/belcar/Developer/sveltekit-repro-1/node_modules/@sveltejs/kit/src/exports/internal/event.js:60:9)
    at wrapper (file:///Users/belcar/Developer/sveltekit-repro-1/.svelte-kit/output/server/chunks/remote.js:548:28)
    at Object.inputs (file:///Users/belcar/Developer/sveltekit-repro-1/.svelte-kit/output/server/chunks/example.remote.js:34:32)
    at prerender (file:///Users/belcar/Developer/sveltekit-repro-1/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:582:47)
    at async MessagePort.<anonymous> (file:///Users/belcar/Developer/sveltekit-repro-1/node_modules/@sveltejs/kit/src/utils/fork.js:23:16)

Node.js v26.7.0
error: script "build" exited with code 1

sveltekit-repro-1 on  trunk via 🥟 v1.3.14
❯
System Info
System:
    OS: macOS 27.0
    CPU: (12) arm64 Apple M2 Max
    Memory: 664.66 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 26.7.0 - /opt/homebrew/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 11.19.0 - /opt/homebrew/bin/npm
    pnpm: 11.21.0 - /opt/homebrew/bin/pnpm
    bun: 1.3.14 - /opt/homebrew/bin/bun
  Browsers:
    Firefox Developer Edition: 154.0
    Safari: 27.0
  npmPackages:
    @sveltejs/adapter-auto: ^7.0.1 => 7.0.1
    @sveltejs/kit: ^2.63.0 => 2.70.2
    @sveltejs/vite-plugin-svelte: ^7.1.2 => 7.3.0
    svelte: ^5.56.1 => 5.56.8
    vite: ^8.0.16 => 8.2.1
Severity

serious, but I can work around it

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the linked sveltekit-repro-1 project by running bun run build. Start with src/core/postbuild/prerender.js and src/exports/internal/event.js, then trace the generated remote.js and example.remote.js stack entries. Done means the build reports which remote function and input relationship caused the failure instead of only exposing the internal request-store error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.