Skip to content

Remote Functions: query was prerendered during the build process #14209

@mustofa-id

Description

@mustofa-id

Describe the bug

While trying out Remote Functions, I noticed that using the query function causes the build to fail. This doesn’t happen with the load function, the build completes fine.

It seems like query is being prerendered during build. I'm not sure if this is expected or if I'm missing something in the setup.

Reproduction

See: Stackblitz

echo "DB_URL=localhost" >> .env

npm run build # OK

# uncomment code lines in todo.remote.js then

npm run build # again, it will fail.

Logs

node:internal/event_target:1101
  process.nextTick(() => { throw err; });
                           ^
Error: DB_URL not set
    at file:///home/mstf/dev/rfc-query-repro/.svelte-kit/output/server/chunks/db.js:16:32
    at ModuleJob.run (node:internal/modules/esm/module_job:329:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
    at async prerender (file:///home/mstf/dev/rfc-query-repro/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js:481:18)
    at async MessagePort.<anonymous> (file:///home/mstf/dev/rfc-query-repro/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/utils/fork.js:23:16)

Node.js v22.17.1
 ELIFECYCLE  Command failed with exit code 1.

System Info

"@sveltejs/kit": "^2.29.1"

Severity

blocking an upgrade

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions