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
yeah that would unfortunately override the secrets - there might be a solution to this soon, I've also raised this recently
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 π€Wow thatβs awesome, thanks @Dario! Iβll take a look soon.
No problem, let me know if that works for you π
@Dario just tried it and it works like a charm! Thank you!
@Benedikt awesome! thanks for giving it a try! π