caddy-dns/cloudflare

Missing API token results in unintuitve error message

Closed this issue · 5 comments

For some reason my Caddy wasn't picking up ENV variables. So when the DNS challenge was made I got this error message: solving challenges: presenting for challenge: adding temporary record for zone \"mydomain.com.\": got error status: HTTP 400: [{Code:6003 Message:Invalid request headers}]. At first that made me think that Cloudflare's API had been updated to require a different header or something. But in fact it was just that it was probably sending an empty API token.

It's not a big deal, happy to see this closed immediately. The main thing is that the error message is searchable, and might save somebody 5 minutes of head scratching.

Duplicate of #27

Thanks; maybe we should add this to the README 🙃 Since Cloudflare hasn't improved the error message.

if caddy environ echoes correctly my api token, can the problem be that caddy sends empty api token?

If your API token is showing up in caddy environ then it's available to Caddy, but your configuration needs to be such that it is used.

It is, I suppose, you can see it here: https://caddy.community/t/using-caddy-with-cloudflare-dns/23833

Solution: in fact with caddy command the API token was available, for the caddy named user, it wasn't (because I'm running caddy as a systemd service)