Sending mails via sendgrid not working
Closed this issue · 4 comments
gearanach commented
Hello,
I am trying to send alerts via SendGrid. However, it doesn't work for some reason. Here are the last log entries from switchboard.log:
2022-09-30T14:00:44+0000 [channel_dns#info] Query: <TRIGGERING_IP> sent <Query <DNS_TOKEN_URL> A IN>
2022-09-30T14:00:44+0000 [channel_dns#info] Unable to format event {'log_namespace': 'channel_dns', 'log_level': <LogLevel=info>, 'log_logger': <Logger 'channel_dns'>, 'log_time': 1664546444.738958, 'log_source': None, 'log_format': {'src_ip': '<TRIGGERING_IP>', 'src_data': {}}}: Log format must be unicode or bytes, not {'src_ip': '<TRIGGERING_IP>', 'src_data': {}}
2022-09-30T14:00:44+0000 [switchboard#error] Exception occurred in switchboard dispatch:
2022-09-30T14:00:45+0000 [channel_dns#info] Query: <TRIGGERING_IP> sent <Query <DNS_TOKEN_URL> AAAA IN>
This is my switchboard.env:
#CANARY_MAILGUN_DOMAIN_NAME=
#CANARY_MAILGUN_API_KEY=
#CANARY_MANDRILL_API_KEY=
CANARY_SENDGRID_API_KEY="<SENDGRID_API_KEY>"
CANARY_PUBLIC_IP=<CANARY_PUBLIC_IP>
CANARY_PUBLIC_DOMAIN=<CANARY_PUBLIC_DOMAIN>
CANARY_ALERT_EMAIL_FROM_ADDRESS="examplemail@example.com"
CANARY_ALERT_EMAIL_FROM_DISPLAY="examplemail@example.com"
CANARY_ALERT_EMAIL_SUBJECT=SubjectLine
#CANARY_IPINFO_API_KEY=
CANARY_TOKEN_RETURN=fortune
CANARY_WEB_IMAGE_UPLOAD_PATH=/uploads
LOG_FILE=switchboard.log
# Default protocol to use in notification links. If you don't use LetsEncrypt, set to http
PROTOCOL=https
ERROR_LOG_WEBHOOK=
CANARY_WG_PRIVATE_KEY_SEED="<CANARY_WG_PRIVATE_KEY_SEED>"
The token gets triggered properly, I checked that.
Do you have any ideas?
gearanach commented
Edit: The API key works when it's being used with curl
gearanach commented
Edit 2: The sender mail matches the one registered in SendGrid. It's the same one I used for the curl requests, where it worked
jayjb commented
Hi @gearanach,
Thanks for reporting this issue. Just a quick check. Are you still experiencing this issue? Did you try using:
CANARY_SENDGRID_API_KEY=<SENDGRID_API_KEY>
without the ''
(quotes).
Please also note we have made some big changes for canarytokens. So please pull the latest code before trying again