caddy-dns / cloudflare

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

Error: "no memory of presenting a DNS record", "Code:6003 Message: Invalid request headers" #27

Closed polarathene closed 3 years ago

polarathene commented 3 years ago

While debugging the DNS challenge failures in https://github.com/caddy-dns/cloudflare/issues/28, I accidentally ran caddy run without passing the ENV for the CF API token and got the error:

2021/05/22 08:35:52.545 INFO    tls.issuance.acme.acme_client   trying to solve challenge       {"identifier": "test.example.com", "challenge_type": "dns-01", "ca": "https://acme-staging-v02.api.letsencrypt.org/directory"}
2021/05/22 08:35:52.754 ERROR   tls.issuance.acme.acme_client   cleaning up solver      {"identifier": "test.example.com", "challenge_type": "dns-01", "error": "no memory of presenting a DNS record for test.example.com (probably OK if presenting failed)"}
2021/05/22 08:35:53.261 ERROR   tls.obtain      will retry      {"error": "[test.example.com] Obtain: [test.example.com] solving challenges: presenting for challenge: adding temporary record for zone example.com.: got error status: HTTP 400: [{Code:6003 Message:Invalid request headers}] (order=https://acme-staging-v02.api.letsencrypt.org/acme/order/19618631/59694492) (ca=https://acme-staging-v02.api.letsencrypt.org/directory)", "attempt": 1, "retrying_in": 60, "elapsed": 5.817538962, "max_duration": 2592000}

This has been noted as an error sent from Cloudflare Invalid request headers, although that isn't evident in the log and requires searching the error online.

Would be useful if the module could recognize that as potentially due to providing an empty token value? (since I provided an environment var to use that wasn't set when running Caddy)

Initially I thought I had hit some rate limit on Cloudflare or LetsEncrypt staging and would have to wait several hours.

mholt commented 3 years ago

I wish their error message was more specific/helpful. Thanks.

LianglRen commented 2 years ago

Thanks, I accidentally wrote the token with braces 'dns cloudflare {XXX}' and this post saved my time.