Closed augustblack closed 2 years ago
Hi there - a few things:
By "There is nothing here yet", do you mean on the Cloudflare side? You use denoflare push <my-worker-name>
(not serve
) to push your script to Cloudflare. They don't enable the "workers.dev" endpoints by default any longer, so you'll either have to:
--workers-dev
option on denoflare push
or the equivalent workersDev
property in your config fileHard to debug your content itself, but if your media is uploaded properly to the bucket it sounds like you should see a directory listing at /media
(and a listing at /
showing one "media/" entry), assuming you enabled directory listing which is either:
--text-binding flags:directoryListing
if not using the config file"flags": { "value": "directoryListing" },
under your script "bindings"
in your config json if using a config fileI was able to find the switch in cloudflare for "Enabling" the route on the worker.
After that, full paths would work, but the directory listings do not. Running locally with "serve" still doesn't list the directories as I would expect.
"scripts": {
"mybucket": {
"path": "https://raw.githubusercontent.com/skymethod/denoflare/v0.5.7/examples/r2-public-read-worker/worker.ts",
"bindings": {
"bucket": { "bucketName": "mybucket" },
"flags": { "value": "directoryListing" },
"workersDev": { "value": "true" }, // hard to know if this goes under binding or not
"directoryListingLimit": { "value": "20" },
"allowCorsOrigins": { "value": "*" },
}
},
},
thanks for any input.
Sorry, looking at the worker code the flag is called listDirectories
, not directoryListing
- they are all in the same tense. I'll fix the docs. Also the workersDev
is just a normal property, not an environment variable.
So:
// Optional schema to get auto-completions when editing this file in vscode, etc
"$schema": "https://raw.githubusercontent.com/skymethod/denoflare/v0.5.7/common/config.schema.json",
"scripts": {
"mybucket": {
"path": "https://raw.githubusercontent.com/skymethod/denoflare/v0.5.7/examples/r2-public-read-worker/worker.ts",
"bindings": {
"bucket": { "bucketName": "mybucket" },
"flags": { "value": "listDirectories" },
"directoryListingLimit": { "value": "20" },
"allowCorsOrigins": { "value": "*" },
},
"workersDev": true,
},
},
Your ide will assist you with things like the workersDev
placement if you add the $schema
property as described in the Configuration documentation
disco.
seems to be working now
Glad to hear it - docs fixed and deployed: https://github.com/skymethod/denoflare-docs/commit/8b7c472451e78d716bebc6cb4312ec9d20c9b74b
Hi,
This looks like an amazing project. Thanks in advance for taking it on and offering up.
I found denoflare while looking for worker script to make an R2 bucket public.
When I follow the example at: https://denoflare.dev/examples/r2-public-read
And, then create a .denoflare jsonc as explained there (but without a custom domain definition and WITH a directoryListing flag) and then do
denoflare serve <my-worker-name>
I get a "There is nothing here yet" page.My R2 bucket has only one '/media' directory in it with many images under it.
So, if I got to https://..workers.dev/media/ I also get the "There is nothing here yet" page.
However, if I run locally with
denoflare server <my-worker-name>
, the http://localhost:8080/ says "file not found"BUT, the http://localhost:8080/media/ does work and shows the image file.
Is it maybe a configuration error?