caddy-dns / cloudflare

Caddy module: dns.providers.cloudflare
Apache License 2.0
436 stars 59 forks source link

Missing API token results in unintuitve error message #72

Closed tombh closed 8 months ago

tombh commented 8 months ago

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.

tombh commented 8 months ago

Duplicate of #27

mholt commented 8 months ago

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

Breinich commented 4 months ago

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

mholt commented 4 months ago

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.

Breinich commented 4 months ago

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)