Is it possible to create a worker/

Is it possible to create a worker/project before deploying?
17 Replies
bentlegen
bentlegenOP3mo ago
Basically I'd like to set secrets before the project deploys
Hard@Work
Hard@Work3mo ago
I know you can via Wrangler, but I don't think so via the Dashboard
bentlegen
bentlegenOP3mo ago
via wrangler, specifically I'm rolling through the docs looking and coming up empty
Hard@Work
Hard@Work3mo ago
Or well, it still creates a "deploy", but with a stub, basically At least if I remember correctly
bentlegen
bentlegenOP3mo ago
oh, hmm, maybe --dry-run?
Hard@Work
Hard@Work3mo ago
Afaik, --dry-run wouldn't upload anything, so that isn't what you want Try wrangler secret put SECRET_NAME
bentlegen
bentlegenOP3mo ago
right, that fails though because there's no worker
This Worker does not exist on your account. [code: 10007]

If you think this is a bug, please open an issue at:
https://github.com/cloudflare/workers-sdk/issues/new/choose
This Worker does not exist on your account. [code: 10007]

If you think this is a bug, please open an issue at:
https://github.com/cloudflare/workers-sdk/issues/new/choose
this is my dilemma i could try deploying some kind of empty "noop" file?
Hard@Work
Hard@Work3mo ago
What wrangler -v version are you on?
bentlegen
bentlegenOP3mo ago
3.99
Hard@Work
Hard@Work3mo ago
Here's what I have:
$ wrangler secret put FOOBAR

⛅️ wrangler 3.105.0
--------------------

Select an account › MyAccount
Enter a secret value: … ***
🌀 Creating the secret for the Worker "fakeworker"
There doesn't seem to be a Worker called "fakeworker". Do you want to create a new Worker with that name and add secrets to it? … yes
🌀 Creating new Worker "fakeworker"...
✨ Success! Uploaded secret FOOBAR
$ wrangler secret put FOOBAR

⛅️ wrangler 3.105.0
--------------------

Select an account › MyAccount
Enter a secret value: … ***
🌀 Creating the secret for the Worker "fakeworker"
There doesn't seem to be a Worker called "fakeworker". Do you want to create a new Worker with that name and add secrets to it? … yes
🌀 Creating new Worker "fakeworker"...
✨ Success! Uploaded secret FOOBAR
bentlegen
bentlegenOP3mo ago
right, i'm specifying the worker name on the command line e.g. wrangler secret put FOOBAR --name myname oic you're prompted to make it
Hard@Work
Hard@Work3mo ago
Let me see if I can replicate with the name on the command line...
bentlegen
bentlegenOP3mo ago
sec dont waste your time, on it ah, it's because i'm not setting a variable, i'm using wrangler secret list --name workername which, im not surprised wouldnt create a worker
Hard@Work
Hard@Work3mo ago
Oh, yeah, that makes sense
bentlegen
bentlegenOP3mo ago
ok ... i'm good 🙂 i got mixed around, apologies (i still think it would be nice to be able to just create an empty worker) via wrangler
Hard@Work
Hard@Work3mo ago
All good, no worries!
Isaac McFadyen
Isaac McFadyen3mo ago
Wrangler is open-source, you could make a feature request Issue for it: https://github.com/cloudflare/workers-sdk
GitHub
GitHub - cloudflare/workers-sdk: ⛅️ Home to Wrangler, the CLI for C...
⛅️ Home to Wrangler, the CLI for Cloudflare Workers® - cloudflare/workers-sdk

Did you find this page helpful?