Marcus
Marcus
CDCloudflare Developers
Created by Marcus on 3/12/2024 in #workers-help
simplest static asset hosting
So, I read through https://github.com/cloudflare/workers-sdk/issues/1162 and it was closed due to the wrangler deploy --assets flag existing; do we have any actual documentation about how that works? Can it be used to host assets for a worker or is it just for using a worker to only host static assets? I'm curious about that answer regardless of whether this is actually the right solution (this is phrased an intentional XY problem), but backing up to give the context as well: I'm hosting discord bots on Workers and am trying to figure out the simplest way (to make a minimal template) to include more than 1MB of assets that they can access (the 25MB/file KV limit is fine here; would attach R2 for anything larger, I get that part). That I can tell, the methods that let you just have a directory in your repo whose contents are autodeployed are: - Use @cloudflare/kv-asset-handler as per https://developers.cloudflare.com/workers/configuration/sites/start-from-worker/. Works, boilerplate-y. - Actually deploy a pages site with one function instead of a worker; have the worker fetch a relative path. Works, feels kind of silly? - Deploy your folder of static assets as a separate static pages site and fetch that site from your worker, hardcoding the .pages.dev domain (I actually did this one because I was lazy and I knew it would work). - Something else? Is that what the --assets flag does? What's this I hear about an ASSETS binding; is that only for pages?
20 replies
CDCloudflare Developers
Created by Marcus on 1/5/2024 in #pages-help
pages-action branch preview URL
Is it possible to grab the branch preview URL out of cloudflare/pages-action? I'm trying to simulate the nice chatops-y build status message the cloudflare build process creates when building in Github instead for more control.
4 replies