[help] secret is not defined in local dev


I’m facing an issue where wrangler2 in local dev tells me that my secret is undefined. Checking the Cloudflare dashboard confirms the secret its set, and wrangler secret list lists it as well. I believe the same code used to work, but it doesn’t anymore. Any idea?

PS: this is my first issue, is this the right place vs the GitHub issues to request for help like this?

This is technically the right place, but with what you’re asking, the Discord would probably be a better place. Probably only use Github issues if you have something to report that needs developer attention.

For local dev, you can use an undocumented .dev.vars file apparently (see this github issue) or possibly an .env though that may only work with Pages and not Workers.

1 Like

Thank you @i40west. The .dev.vars solution solved my problem and is a much better experience as well.

Noted also on avoiding github issues. What’s the difference between this community site and discord? Too many places is rather confusing and I’m personally not a fan of chat-based communities to be honest.

Discord is more like IRC. It’s not as convenient, but the developers hang out there and you can get answers there to questions like yours, which had a solution that wasn’t even in the documentation yet. Sometimes when you’re working on a platform that’s a moving target you need something more like that. But there’s no official customer support there and probably a lot less tolerance for … you know … dumb questions (which yours wasn’t) :joy:

1 Like

Haha, thanks for the clarification and good to know the panel of options we have to reach out :).

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.