-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adapter-cloudflare: only including _app
content in _routes.json
#7640
Comments
Here's a list of the cloudflare folder. Assets are definitely there and they work fine locally with https://gist.github.com/hazre/1ebf72e8f43f0252822076aa6c33b3c6 |
@jrf0110 tagging you in case you or anyone else from Cloudflare might be interested in giving this one a look. We no longer have any Svelte maintainers employed at Cloudflare and I don't have a Cloudflare account so couldn't be very confident in any attempt I made |
When deploying to Cloudflare with kit |
@benmccann I'll get some 👀 on this today! Thanks for the ping |
@tedsteen that sounds like a separate issue |
started looking at this, wrote up notes in #7667 |
Just to clarify, the |
Yeah, sorry for that, maybe we can change the title and the content: I just check the code, I never use CloudFlare, I assume the routes file being used for routing. |
Generated {
"version": 1,
"description": "Generated by @sveltejs/adapter-cloudflare",
"include": [
"/*"
],
"exclude": [
"/_app/immutable/*",
"/favicon-16x16.png",
"/favicon-32x32.png",
"/favicon.ico"
]
} |
Is there a bug to report here? Is the listed severity correct?
|
Am I correct in assuming this would also fix the version.json calls from counting towards the quota on CF? Because I seem to be running into the problem where if one (or a few) users leave open their tab, it will do thousands of function requests, quickly ramping up costs. |
Yes. Alternative this line... kit/packages/adapter-cloudflare/index.js Line 81 in 284b20b
immutable part.
@jrf0110 is there any likelihood that we could just exclude all static assets (perhaps behind an option in the adapter), without adding them individually to the |
I'm unsure if this is related, but any generated items are not added to the manifest. I'm running into a similar issue to the one mentioned here (xiphux/svimg#16 (comment)). This package outputs transformed images to a subfolder inside the All of the images in the generated folder return 404 when trying to access them, but the two untransformed images in the However, none of the generated images are in the manifest, which seems to be the reason why they aren't served. If I made the build run twice, it will output these files to the manifest, which allows Cloudflare to recognize and serve the files. I feel the solution to this could be adding generated files to the manifest after running other preprocess steps. |
Only a slight exaggeration. Currently, almost any request that goes through would count as a function invocation. My site is mostly static except for a few (4) endpoints that must have server-side code. According to Cloudflare analytics, my site gets 1-1.5 million (uncached) requests on an average day (and is growing). The endpoints only get ~10,000 requests per day. This issue is the difference between my side-project being free and it being yet another subscription I have to pay for (seemingly unnecessarily, since the sections that actually need functions take up <1% of the total requests). My site is growing, so I would probably have to pay for it at some point, but when I do, it would be much better if I only had to pay for the function requests I actually use, instead of the ones just serving static content. Currently, I'm using svelte-multi-adapter to use both the static adapter and the nodejs adapter. I'm then deploying the static site to cloudflare pages, (for most of the content on the website) then the nodejs generated server to a vps I have to host somewhere else. Obviously, this setup is not ideal. |
* include as many static assets as possible in exclude list - closes #7640 * temporarily add trailing slash * Revert "temporarily add trailing slash" This reverts commit f3ff35f. * add a warning * fix typo * fix string * Update .changeset/giant-penguins-act.md Co-authored-by: Ben McCann <[email protected]> * fix Co-authored-by: Simon H <[email protected]> Co-authored-by: Ben McCann <[email protected]>
Describe the bug
The adapter should include any assets inside the
client
output folder instead_app
only (kit.appDir
).Latest changes in kit allow plugins to emit/generate assets in the client folder:
@vite-pwa/sveltekit
,sitemap
...The problem is here: https://github.com/sveltejs/kit/blob/master/packages/adapter-cloudflare/index.js#L42 (should include the client folder)
Reproduction
no, sorry, just reported from Discord here: https://discord.com/channels/937808017016119440/937973377883336704/1041084393239891988https://github.com/hazre/neosvr-mod-manager/tree/fix/pwa
Logs
No response
System Info
Severity
blocking all usage of SvelteKit
Additional Information
The app is using the new
@vite-pwa/sveltekit
plugin to add the PWA, cloudflare returns 404 for the service worker and webmanifest assets.The text was updated successfully, but these errors were encountered: