# Can't request cert with dns-01 cloudflare

**URL:** <https://community.letsencrypt.org/t/cant-request-cert-with-dns-01-cloudflare/121533>\
**Category:** Help\
**Created:** [May 3, 2020, 6:10pm UTC](https://community.letsencrypt.org/t/cant-request-cert-with-dns-01-cloudflare/121533 "2020-05-03T18:10:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nickmansrob](https://avatars.discourse-cdn.com/v4/letter/n/58956e/32.png) [@nickmansrob](https://community.letsencrypt.org/u/nickmansrob)\
**Post date:** [May 3, 2020, 6:10pm UTC](https://community.letsencrypt.org/t/cant-request-cert-with-dns-01-cloudflare/121533/1 "2020-05-03T18:10:29Z")

</div>

My domain is: rndevelopment.ga

I ran this command: `certbot certonly --dns-cloudflare --dns-cloudflare-credentials /root/.secrets/certbot/cloudflare.ini -d rndevelopment.ga`

It produced this output: [https://pastebin.com/tBqgLpeY](https://pastebin.com/tBqgLpeY)

My web server is: nginx/1.14.2

The operating system my web server runs on: Debian 10 (buster)

I can login to a root shell on my machine: yes

The version of my client is: certbot 0.31.0

The manual command does work: `certbot --server https://acme-v02.api.letsencrypt.org/directory -d rndevelopment.ga --manual --preferred-challenges dns-01 certonly`

Thanks in advance  
Rob Nickmans

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [May 3, 2020, 6:20pm UTC](https://community.letsencrypt.org/t/cant-request-cert-with-dns-01-cloudflare/121533/2 "2020-05-03T18:20:58Z")

</div>

I'm not sure why there's a "KeyError: 'code'" exception in the CloudFlare python package, but what I did see was:

> 2020-05-03 20:02:36,524:DEBUG:urllib3.connectionpool:[https://api.cloudflare.com:443](https://api.cloudflare.com:443) "POST /client/v4/zones/ef927dc2fece1c17b6a6b9de238a116f/dns\_records HTTP/1.1" 401 None

See the HTTP 401 return code? According to the [CloudFlare API v4 documentation](https://api.cloudflare.com/#getting-started-responses) that means the user isn't authorized.

---

<div class="post-metadata">

**Author:** ![mnordhoff](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/mnordhoff/32/22583_2.png) [@mnordhoff](https://community.letsencrypt.org/u/mnordhoff)\
**Post date:** [May 3, 2020, 6:22pm UTC](https://community.letsencrypt.org/t/cant-request-cert-with-dns-01-cloudflare/121533/3 "2020-05-03T18:22:59Z")

</div>

I guess the Cloudflare API is returning some kind of error, but a bug in the Cloudflare Python library is causing it to eat the error message and do this instead. There’s an open issue about that:

> <https://github.com/cloudflare/python-cloudflare/issues/92>
>
> DNS record deletion causes exception - it seems like API returns error, but without 'code' (it's not mandatory)
> \_raw() call returns {'error':...

From what that issue also says, Cloudflare might not allow the DNS API to be used with .ga domains.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)\
**Post date:** [June 2, 2020, 6:23pm UTC](https://community.letsencrypt.org/t/cant-request-cert-with-dns-01-cloudflare/121533/4 "2020-06-02T18:23:01Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
