wrangler types command with secrets

I'm using the 'wrangler types' command to generate types for my bindings. Now, I have some secrets that I use in the app that I specify in .dev.vars (as recommended), but they of course don't get picked up by the wrangler command so my types are missing the env vars as strings that represent the secrets. Is there any way to solve this? e.g. should I specify empty vars in wrangler.toml to have them in the types or does this override the secrets then?
6 Replies
DaniFoldi
DaniFoldiβ€’10mo ago
yeah that would unfortunately override the secrets - there might be a solution to this soon, I've also raised this recently
Dario
Darioβ€’10mo ago
Hey @Benedikt πŸ‘‹ I've just implemented a fix to make wrangler types pick up the secrets from .dev.vars , it's part of this PR: https://github.com/cloudflare/workers-sdk/pull/5042 If you want please feel free to try the PR's prerelease: https://github.com/cloudflare/workers-sdk/pull/5042#issuecomment-1948986060 I'll try to get it merged before the next stable wrangler release 🀞
Benedikt
BenediktOPβ€’10mo ago
Wow that’s awesome, thanks @Dario! I’ll take a look soon.
Dario
Darioβ€’10mo ago
No problem, let me know if that works for you πŸ˜„
Benedikt
BenediktOPβ€’10mo ago
@Dario just tried it and it works like a charm! Thank you!
Dario
Darioβ€’10mo ago
@Benedikt awesome! thanks for giving it a try! πŸ˜„
Want results from more Discord servers?
Add your server