Secret "MY_SECRET" not found

I'm trying to use secrets store locally by running wrangler dev --x-remote-bindings but when I try to access my secrets using env.MY_SECRET.get() I get a secret not found error. Note that when I run wrangler dev --remote, everything works fine
1 Reply
Ricky U
Ricky U3mo ago
: 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.

Did you find this page helpful?