cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.58k stars 663 forks source link

Gracefully handle secrets listing before script upload #4018

Open cfjedimaster opened 11 months ago

cfjedimaster commented 11 months ago

Which Cloudflare product(s) does this pertain to?

Workers Runtime

What version(s) of the tool(s) are you using?

3.9.0

What version of Node are you using?

20.0.0

What operating system are you using?

WSL

Describe the Bug

In a worker project, tried to get my secrets by using npx wrangler secret list, and I get:

✘ [ERROR] A request to the Cloudflare API (/accounts/993fbeecf14d8652dd537b752b083bdf/workers/scripts/randomcover/secrets) failed.

  workers.api.error.script_not_found [code: 10007]

I confirmed via npx wrangler whoami that I am logged in.

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

cfjedimaster commented 11 months ago

The issue appears to be because I had not set any keys yet. As soon as I do, it works, but obviously the result should have been something like, '0 keys set' or somesuch.

admah commented 7 months ago

@cfjedimaster thanks for filing this issue. I just checked this behavior on Wrangler 3.28.1 and get the following:

Image

I do think we should have some better messaging to indicate that there are no secrets set for the current worker.

cc: @dbenCF

cheradenine commented 3 months ago

I hit this too. FWIW I added a secret, listed it, deleted it and then I got back [] so its related to a new project with no secrets ever added yet.

I also don't understand where these go in the UI - I had tried adding them there first and they are not listed, and when I add them via the cli they are also not in the UI.