Eugene
Eugene
CDCloudflare Developers
Created by Eugene on 11/15/2024 in #workers-help
Provision secrets from the command line
Hello. I'd like to be able to provision secrets on Cloudflare conveniently. I'd like to do npx wrangler secret put <KEY> for example and for Wrangler to get the key from .dev.vars? I don't want to paste the key into the keyboard or type it in. How do you solve this workflow problem? Or maybe I'm missing something? Thanks
4 replies
CDCloudflare Developers
Created by Eugene on 11/15/2024 in #workers-help
npx wrangler kv:key put test4... -local --persist-to worker-local
Hello. Doing npx wrangler kv:key put test4 0123456 --binding MY_KV_NAMESPACE --local --persist-to worker-local gives :
⛅️ wrangler 3.87.0
-------------------


✘ [ERROR] Can't redefine existing key
⛅️ wrangler 3.87.0
-------------------


✘ [ERROR] Can't redefine existing key
` I got the instruction here. Can someone please give a hint?
1 replies
CDCloudflare Developers
Created by Eugene on 11/14/2024 in #workers-help
Does it worker get its own wrangler file
Hello. Does each worker gets its own wrangler file or its one wrangler file per project? I'm asking for a few reasons but one, is that when I created a worker using the UI, I was not provided with a wrangler file but when I tried to create one, it told me this project already has a wrangler file. Try it out yourself. Create a basic worker, go to edit code and try to create a wrangler.toml file. It'll give you an error saying that it already exists.
2 replies
CDCloudflare Developers
Created by Eugene on 11/14/2024 in #workers-help
Worker path not marching redirect URL hosted on a bucket
Hello. I'm using the basic worker example on cloudflare called "Common Worker Examples". My domain is hosted on a gcloud bucket. I setup the routes in Cloudflare as so:
Route www.hello-world.info/redirect*
Route www.hello-world.info
Route www.hello-world.info/redirect*
Route www.hello-world.info
When I land on www.hello-world.info and press the links (from the worker script) , I get redirected here: https://www.hello-world.info/redirect?redirectUrl=https://example.com/ with the 404 page from my bucket. Same thing if I go to https://www.hello-world.info/redirect?redirectUrl=https://example.com/ directly. However, if I go redirectly to https://www.hello-world.info/redirect I get the error message from the script Redirect URL not provided So, I'm 100% confused. It seems that the URLs https://www.hello-world.info and https://www.hello-world.info/redirect match the routes in cloudflare but https://www.hello-world.info/redirect?redirectUrl=https://example.com/ does not? Or maybe it's something else? Can someone please give a hint? Thanks
2 replies