-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
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.
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:

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.0Severity
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.