aws-api-gateway-letsencrypt icon indicating copy to clipboard operation
aws-api-gateway-letsencrypt copied to clipboard

HTTP 400 listing cloudflare dns_records

Open ctaggart opened this issue 8 years ago • 2 comments
trafficstars

This may be an upstream problem with lexicon. I'm not sure yet. When I run this, I get this HTTP 400 error:

Starting new HTTPS connection (1): api.cloudflare.com
https://api.cloudflare.com:443 "GET /client/v4/zones?status=active&name=ctaggart.com HTTP/1.1" 200 None
Starting new HTTPS connection (1): api.cloudflare.com
https://api.cloudflare.com:443 "POST /client/v4/zones/d916dd95774cecf669b9cbdcce010be0/dns_records HTTP/
1.1" 400 None
Traceback (most recent call last):
  File "/usr/local/bin/lexicon", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/lexicon/__main__.py", line 69, in main
    client.execute()
  File "/usr/local/lib/python2.7/site-packages/lexicon/client.py", line 40, in execute
    return self.provider.create_record(self.options.get('type'), self.options.get('name'), self.options.
get('content'))
  File "/usr/local/lib/python2.7/site-packages/lexicon/providers/cloudflare.py", line 45, in create_record
    payload = self._post('/zones/{0}/dns_records'.format(self.domain_id), data)
  File "/usr/local/lib/python2.7/site-packages/lexicon/providers/base.py", line 76, in _post
    return self._request('POST', url, data=data, query_params=query_params)
  File "/usr/local/lib/python2.7/site-packages/lexicon/providers/cloudflare.py", line 125, in _request
    r.raise_for_status()  # if the request fails for any reason, throw an error.
  File "/usr/local/lib/python2.7/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.cloudflare.com/client/v4/zones/d916dd95774cecf669b9cbdcce010be0/dns_records

An error occurred (NotFoundException) when calling the GetBasePathMapping operation: Invalid base path mapping identifier specified

An error occurred (ConflictException) when calling the CreateBasePathMapping operation: Only one base path mapping is allowed if the base path is empty.
--> Validating that all required environmental variables are set
--> Ensure that our API Gateway exists (otherwise none of this matters)
Valid Longer than 10 days. Skipping renew!
--> Configure Dehydrated & Lexicon (keysize for AWS has to be 2048)
--> Check if 'api.ctaggart.com' is already registered with AWS api gateway
Successfully retrieved existing AWS distribution domain name
--> Create or update CNAME DNS record for cloudflare which points to AWS distribution domain name
--> Check if custom domain is already mapped to API Gateway
Custom domain needs to be mapped to API Gatway
--> Cleanup all temp files

ctaggart avatar Sep 21 '17 09:09 ctaggart

Hmm. I haven't used this script in a while, so I haven't run into an issue like this myself. I'm suprised that the script continued past the error, I would have expected it to fail and exit out.

AnalogJ avatar Sep 21 '17 14:09 AnalogJ

@AnalogJ having a similar problem here, and this thread seems related. (lexicon dont have a slash after dns_records)

jokester avatar Oct 26 '17 06:10 jokester