Unable to access secret-store in local dev

I have defined a couple of secrets in the Cloudflare secrets-store. I have created bindings in the wrangler.jsonc file. But when running the worker locally, I get an error that the secret is "not found". I have tried defining these in the .dev.vars file but to no avail. When running wrangler dev it does say:
- Secrets Store Secrets:
- instanceUrl: a0d7fd5ae3af4aad8c87bccb41323cac/TS_INSTANCE_URL [simulated locally]
- accessToken: a0d7fd5ae3af4aad8c87bccb41323cac/TS_ACCESS_TOKEN [simulated locally]
- Secrets Store Secrets:
- instanceUrl: a0d7fd5ae3af4aad8c87bccb41323cac/TS_INSTANCE_URL [simulated locally]
- accessToken: a0d7fd5ae3af4aad8c87bccb41323cac/TS_ACCESS_TOKEN [simulated locally]
But, when running the worker it says:
✘ [ERROR] Error: Secret "TS_ACCESS_TOKEN" not found
✘ [ERROR] Error: Secret "TS_ACCESS_TOKEN" not found
6 Replies
Ricky U
Ricky U7mo ago
yes i get the same error, it doesnt work locally you will have to put --remote on nox wrangler dev --remote -- but you wont see any logs?! i still cant find a way to get serets store working locally with remote bindings well.
Daniel Klein
Daniel Klein7mo ago
it is working locally you just have to put the secret through CLI without the --remote flag
Ricky U
Ricky U7mo ago
Hi @Daniel Klein can you demonstate how would i pass in the keys locally? and can i save the keys somewhere so i dont have to do it everytime.
Daniel Klein
Daniel Klein7mo ago
Cloudflare Docs
Use Secrets Store with Workers
Cloudflare Secrets Store is a secure, centralized location in which account-level secrets are stored and managed. The secrets are securely encrypted and stored across all Cloudflare data centers.
Daniel Klein
Daniel Klein7mo ago
Just use the command in docs without —remote flag it should be kept in .wrangler and should be there until you manually remove that folder
ashish
ashishOP7mo ago
I stored the secrets using the dashboard secret store, if I do not use the --remote flag to create the secrets will they still be saved on the dashboard for reference when the worker actually gets deployed ?

Did you find this page helpful?