Skip to content

CloudFlare Workers Adapter can't serve prerendered pages #11210

@nosovk

Description

@nosovk

Describe the bug

We embed svelte kit blog inside existing site, using Cloudflare workers to intercept requests to /blog* route. Previously we had an issue that scenario #10937 that was successfully fixed in recent upgrade. Now, pages are successfully served from subpath. But if we want to serve prerendered page content, attempt to open the page directly causes error. It means that if I go to /blog page, and then go over the link to /blog/prerender page - everything works as excepted. But if you try to open blog/prerender page directly - you will gate Cloudflare 1101 error.
As far I understand, prerendered page generated during build. And even more - it's contend stored inside corresponding KV. But when I try to open the page directly - there is some error in manifest, because of what matching KV entry isn't found.

image I can see that in KV resulting key is not `prerender.html`, but `blog/prerender.cfcc6a4220.html` I think that hash is added by vite, but actually I didn't figure out how key name related to manifest inside build. I mean, that file `/blog/prerender.cfcc6a4220.html` doesn't served by direct link.

Reproduction

repository: https://github.com/nosovk/sveltekit-cloudflare-workers-repro

broken test link: https://sveltekit-cloudflare-workers-repro.nosovk.workers.dev/blog/prerender

it will fail if you will try to open it directly.

But you still can visit that page, by opening that link:

https://sveltekit-cloudflare-workers-repro.nosovk.workers.dev/blog/

and that pressing on a link to /prerender page

inside logs we can see error like that:
image

Logs

{
  "outcome": "exception",
  "scriptName": "sveltekit-cloudflare-workers-repro",
  "diagnosticsChannelEvents": [],
  "exceptions": [
    {
      "name": "Error",
      "message": "_KVError: could not find prerender.html in your content namespace",
      "timestamp": 1701905948034
    }
  ],
  "logs": [],
....
}

System Info

System:
    OS: Windows 11 10.0.22621
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-1370P
    Memory: 35.48 GB / 63.67 GB
  Binaries:
    Node: 20.5.1 - ~\AppData\Local\fnm_multishells\23348_1701858361774\node.EXE
    npm: 10.2.1 - ~\AppData\Local\fnm_multishells\23348_1701858361774\npm.CMD
    pnpm: 8.6.12 - ~\AppData\Local\fnm_multishells\23348_1701858361774\pnpm.CMD
  Browsers:
    Edge: Chromium (119.0.2151.97)
    Internet Explorer: 11.0.22621.1
  npmPackages:
    @sveltejs/adapter-cloudflare-workers: ^1.2.2 => 1.2.2
    @sveltejs/enhanced-img: ^0.1.5 => 0.1.5
    @sveltejs/kit: ^1.27.7 => 1.27.7
    svelte: ^4.2.0 => 4.2.2
    vite: ^4.0.0 => 4.5.0

Severity

blocking all usage of SvelteKit

Additional Information

Unfortunately for a blog it's crucial to being indexed by Google, it means that without prerender it's not very usefull.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p1-importantSvelteKit cannot be used by a large number of people, basic functionality is missing, etc.paths.basebugs relating to `config.kit.paths.base`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions