Skip to content

Prerendered Remote Function failing on SSR in Cloudflare Workers @sveltejs/adapter-cloudflare #15035

@alecbakholdin

Description

@alecbakholdin

Describe the bug

Prerendered functions don't work with SSR in Cloudflare Workers. When I disable ssr with export const ssr = false, the issue no longer persists.

Reproduction

Repository: https://github.com/alecbakholdin/minimal-cloudflare-remote-fn-test (build files included)
Bug in the wild: https://minimal-cloudflare-remote-fn-test.alecbakholdin.workers.dev

  1. Create a remote function (const testFn = export const testFn = prerender(() => { return "testing"; });)
  2. Call remote function in src/routes/+page.svelte with {await testFn()}
  3. npm run build && npx wrangler deploy
  4. Go to the site and see 500. Logs below

Logs

This is the only relevant log I can find

�[1;31m[500] GET /�[0m
Error: Prerendered response not found
    at _worker.js:3303:25
    at async _worker.js:3312:42
    at async _worker.js:3297:18

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700K
    Memory: 11.74 GB / 15.47 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.19.0 - /home/abakholdin/.nvm/versions/node/v20.19.0/bin/node
    npm: 11.6.2 - /home/abakholdin/.nvm/versions/node/v20.19.0/bin/npm
    pnpm: 10.18.2 - /home/abakholdin/.nvm/versions/node/v20.19.0/bin/pnpm
    Deno: 2.5.6 - /home/abakholdin/.local/share/nvim/mason/bin/deno
  npmPackages:
    @sveltejs/adapter-auto: ^7.0.0 => 7.0.0 
    @sveltejs/adapter-cloudflare: ^7.2.4 => 7.2.4 
    @sveltejs/kit: ^2.48.5 => 2.49.1 
    @sveltejs/vite-plugin-svelte: ^6.2.1 => 6.2.1 
    svelte: ^5.43.8 => 5.45.6 
    vite: ^7.2.2 => 7.2.6

Severity

serious, but I can work around it

Additional Information

I can't reproduce this minimally, but on the project where I discovered this bug, sometimes this would work on first page load but not on reloads or afterwards on client-side navigation.

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