Comments (11)
Thank you for all your assistance on this
yes, a base/prefix thing could potentially be useful but not really a big deal
from render.
Hi @catharsis71, are you using wrangler2? Wrangler v1 doesn't work with the new wrangler.toml
s.
from render.
seems like I have wrangler 1.19.12
is there any way to make it work with that version or am I just out of luck?
from render.
Hmm, try setting type
to javascript
and running npm run prepublishOnly
before publishing to compile the TypeScript to JavaScript (it should create the dist/index.js
entrypoint).
from render.
Well that did something but I'm not sure what
$ wrangler publish
✨ Basic JavaScript project found. Skipping unnecessary build!
Error: Something went wrong with the request to Cloudflare...
Uncaught SyntaxError: Cannot use import statement outside a module
at line 1
[API code: 10021]
I'll look into trying to get wrangler2 but I'm close to giving up on R2 because they make everything far too difficult
I don't suppose there's any possibility of doing this through the Cloudflare dashboard instead of using wrangler? I tried using the worker "Quick Edit" button and pasting in stuff from the index.js or index.ts but unsurprisingly it didn't work. I don't really even want to have all this NPM / etc stuff installed, I just installed it all temporarily and plan on uninstalling everything once the worker is functional (or I give up on the whole endeavor)
from render.
Yeah, I'm not entirely sure why it's not working with Wrangler v1.
I don't think there's a way with the dashboard either, since it's a bit outdated TMK.
However, you can always try the GitHub Actions method, it doesn't require anything locally- you can create the R2 bucket, etc from the Cloudflare dashboard. If you decide on doing that, feel free to ask me if any issues arise.
from render.
trying again now with wrangler2
$ wrangler2 publish
⛅️ wrangler 2.0.7
-------------------
✘ [ERROR] Could not resolve "range-parser"
src/index.ts:1:23:
1 │ import parseRange from "range-parser";
╵ ~~~~~~~~~~~~~~
You can mark the path "range-parser" as external to exclude it from the bundle, which will remove
this error.
✘ [ERROR] Build failed with 1 error:
src/index.ts:1:23: ERROR: Could not resolve "range-parser"
If you think this is a bug then please create an issue at https://github.com/cloudflare/wrangler2/issues/new.
from render.
Now I'm trying the Github Actions method
is this the correct place for the secrets?
When I was running wrangler locally I just used "wrangler login" so I didn't have to mess with tokens/keys
I tried setting CF_API_TOKEN to my Global API Key but Cloudflare didn't seem to like it, I guess I actually need to create a token for this but what permissions does it need?
from render.
✘ [ERROR] Could not resolve "range-parser"
Right, I forgot, you need to run npm install
before. I'll put that in the README.
is this the correct place for the secrets?
Yup!
I tried setting CF_API_TOKEN to my Global API Key but Cloudflare didn't seem to like it, I guess I actually need to create a token for this but what permissions does it need?
Just Workers Scripts:Edit
. I'll put that in the README as well.
Edit: README has been updated!
from render.
okay so we definitely have some level of functionality now
with a custom subdomain, seems to be working fine
using workers.dev was also working fine but I turned it off because I don't really need it
then I got to looking at "routes" stuff which I don't really understand
I thought maybe instead of being reliant on a files.(domain).com subdomain, I could rig it so that (domain).com/files/ also works
and it's clearly hitting the script because I'm getting your "File Not Found" message but I'm getting that even when requesting a file that does exist, also, requests to (domain).com/files/ without a file specified get "File Not Found" instead of "OK"
If I do it like this do I need to move all my files into a /files/ subdirectory in the bucket or something along those lines?
sorry to venture off-topic from what I opened this for
from render.
If I do it like this do I need to move all my files into a /files/ subdirectory in the bucket or something along those lines?
Yeah, you'd have to prefix all your files with files/
. I could add functionality to have a base/prefix path to look for, if you like.
I'll also close this issue since the original problem was resolved, but if you have any other questions feel free to ask them.
from render.
Related Issues (19)
- 0-byte files cause issues HOT 6
- Configuring CORS (Access-Control-Allow-Origin) HOT 5
- Music playing CORS/Cache/worker error HOT 4
- Turn off cache? HOT 4
- Cache hit ignored for 304 response HOT 2
- Remove `range-parser` dependency HOT 2
- List items in bucket HOT 13
- Etag needs to be quoted? HOT 2
- Add Edge-Side-Includes HOT 1
- Chinese characters may display as garbled text HOT 6
- File Not Found HOT 3
- Way to invalidate cache when object at R2 path changes? HOT 3
- Not all files listed HOT 5
- Remove type from <style> tag -- causes WC3 validation warning HOT 1
- add variable for HTML language declaration?
- how to upload HOT 2
- cache.put always fired HOT 2
- site showing errors always in the first requests to a file HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from render.