Secret Store In Local Dev Mode?

I am using the new Secrets Store, and using them in a worker using the binding in the toml file, but in dev mode using npx wrangler dev the console shows : Secret "MDB_URI" not found Well Okay the docs say : Local development mode This guide assumes you are working in production. To use Secrets Store locally, you must use secrets-store secret Wrangler commands without the --remote flag. Well If I follow that it says : --remote option In order to interact with Secrets Store in production, you should append --remote to your command. Without it, your command will default to local development mode. Okay so all I want is the npx wrangler to use my remote secret store?
9 Replies
Ricky U
Ricky UOP8mo ago
Okay so using the --remote flag like npx wrangler dev does use my remote SECRETS STORE bindings, but has a sideeffect of not logging any console.log in my local dev console... so back to use my local secret store -- how do i do that, is there a fall back for using the .dev.vars -- the docs arent clear how exactly to use SECRETS STORE locally?
Rex
Rex7mo ago
Hey im having the same issue, i setup everything correctly, somehow its still not possible to access my Values in Local Mode
Rex
Rex7mo ago
both of them are in the .wrangler file, the UUID Points to the Blob, however in dev mode it keeps saying MAIL_KEY not found?
No description
Ricky U
Ricky UOP7mo ago
i am still struggling with this.
Rex
Rex7mo ago
i resorted to a dev Variable and switching the GET Method on the fly :Sadge:
Ricky U
Ricky UOP6mo ago
how pls?
Merlijn
Merlijn6mo ago
Anyone figured this out? I have no clue
Ricky U
Ricky UOP6mo ago
oh gosh me too. Secrets STore, but working locally will not work even with the --remote flag @Rex How ? Solved : you need to use npx wrangler secrets-store secret create <STOREid> --name <VAR_NAME> --scopes workers --value "DB SECRET HERE" -- now this should create a local secret store (without using the --remote flag, otherwise it may overwrite your real secrets store.. now this will not use your .dev.env which is far better.. the only issue i see is that you may need to run this everytime.
ALECKS
ALECKS5mo ago
@Ricky U are you able to share the secrets store across multiple wrangler dev instances? I'm seeing that secrets defined in one wrangler project (folder with a wrangler.jsonc) are not seen by another project. Even tried using --persist-to

Did you find this page helpful?