How to update Worker secrets via REST API (or TS SDK)?
I found such undocumented endpoints in
wrangler
's source code:
- To create and update Worker's secret:
https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/workers/scripts/<WORKER_NAME>/secrets
- To delete Worker's secret:
https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/workers/scripts/<WORKER_NAME>/secrets/<SECRET_KEY>
Unfortunately they are not working. The update one fails with error saying that the key is already in use - of course it is:
So I tried to delete it first. And the delete one doesn't work as well saying the binding not found when it's already there:
The API access token I'm using has full read/write previlages in the scope of the worker's zone.
I'm completely out of ideas. Please help.GitHub
workers-sdk/packages/wrangler/src/secret/index.ts at main · cloudfl...
⛅️ Home to Wrangler, the CLI for Cloudflare Workers® - cloudflare/workers-sdk
1 Reply
Leaving my source code below:
Anyone?