Cloudflare's secrets functionality & Mailjet?

Trying to authenticate with Mailjet and finding send mail errors. API key and secret are correct and have the necessary permissions on Mailjet's side. If everything seems correct but Mailjet rejects it. Also trying Mailgun. Cloudflare Worker global encrypted keys sent as a base64 authorization header, the authorization header is formatted correctly. Is the secret functionality a bug in Workers?
3 Replies
kurtleblanc
kurtleblancOP10mo ago
If secret values are not visible within Wrangler or Cloudflare dashboard after you define them. This means that sensitive data, including passwords or API tokens, should always be encrypted to prevent data leaks. Sounds like this means even when formatted correctly will always be encrypted even at the Mailjet endpoint? While I'm new to Workers. Currently learning about Worker Environments and setting up environment variables and environment application keys. This might be helpful to investigate as to why I'm having failure issues. I've not yet tried using --env production at the end of my wrangler secret put commands.
Chaika
Chaika10mo ago
I'm not sure I fully understand your question but secrets can be accessed the same as normal environment variables in Workers, that is they're in plaintext inside of a Worker. The only difference is you can't see them in the dashboard/wrangler and they're not needed to be set in the .toml for --remote dev or live workers. For local testing you'd want them in .dev.vars
kurtleblanc
kurtleblancOP10mo ago
Secrets sent from worker to endpoint for auth failed. I thought I was in a prod env but maybe not? I'm building a serverless form handler environment variable works fine until I encrypt it. Then the error: ReferenceError: "SECRET_KEY" is not defined. Okay found that this worked --> wrangler secret put SECRET_KEY --env production
Want results from more Discord servers?
Add your server