Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating records on godaddy throws: 422 Client Error: Unprocessable Entity #362

Open
mpfusion opened this issue Feb 9, 2019 · 5 comments

Comments

@mpfusion
Copy link

mpfusion commented Feb 9, 2019

Attempts to create or delete DNS records using the following command

lexicon godaddy \
  --auth-key="$key" --auth-secret="$secret" \
  create "$domain" TXT \
  --name "foo.$domain" \
  --content "bar"

fails with

Traceback (most recent call last):
  File "/usr/local/bin/lexicon", line 11, in <module>
    load_entry_point('dns-lexicon==3.1.4', 'console_scripts', 'lexicon')()
  File "/usr/local/lib/python3.6/site-packages/lexicon/cli.py", line 117, in main
    results = client.execute()
  File "/usr/local/lib/python3.6/site-packages/lexicon/client.py", line 71, in execute
    return self.provider.create_record(record_type, name, content)
  File "/usr/local/lib/python3.6/site-packages/lexicon/providers/base.py", line 80, in create_record
    return self._create_record(rtype, name, content)
  File "/usr/local/lib/python3.6/site-packages/lexicon/providers/godaddy.py", line 115, in _create_record
    self._put('/domains/{0}/records'.format(domain), records)
  File "/usr/local/lib/python3.6/site-packages/lexicon/providers/base.py", line 148, in _put
    return self._request('PUT', url, data=data, query_params=query_params)
  File "/usr/local/lib/python3.6/site-packages/lexicon/providers/godaddy.py", line 269, in _request
    result.raise_for_status()
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.godaddy.com/v1/domains/example.com/records

The record is created, though. Optaining a list of records works without error:

lexicon godaddy list "$domain" TXT --auth-key="$key" --auth-secret="$secret"

Let me know if you need further information.

11.2-STABLE FreeBSD
lexicon 3.1.4

@sebkouba
Copy link

sebkouba commented Mar 1, 2019

I'm getting a similar error on 3.1.5 for all operations (except once I was able to create a record, now running the same command produces and error - having deleted the entry manually).

lexicon godaddy --auth-key key --auth-secret secret create "domain.net" A --name="sub.domain.net" --content="1.1.1.111"

Traceback (most recent call last):
  File "/usr/local/bin/lexicon", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/lexicon/cli.py", line 117, in main
    results = client.execute()
  File "/usr/local/lib/python2.7/dist-packages/lexicon/client.py", line 71, in execute
    return self.provider.create_record(record_type, name, content)
  File "/usr/local/lib/python2.7/dist-packages/lexicon/providers/base.py", line 80, in create_record
    return self._create_record(rtype, name, content)
  File "/usr/local/lib/python2.7/dist-packages/lexicon/providers/godaddy.py", line 115, in _create_record
    self._put('/domains/{0}/records'.format(domain), records)
  File "/usr/local/lib/python2.7/dist-packages/lexicon/providers/base.py", line 148, in _put
    return self._request('PUT', url, data=data, query_params=query_params)
  File "/usr/local/lib/python2.7/dist-packages/lexicon/providers/godaddy.py", line 269, in _request
    result.raise_for_status()
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 422 Client Error: Unprocessable Entity for url: https://api.godaddy.com/v1/domains/mydomain.net/records

@derekaug
Copy link

I was getting 422 errors and went into Godaddy's API tools to test things out, for my domain that was giving me grief, I'm getting this error in my 422 response:

"At least two NS records must be specified in the request body"

After resolving all API validation errors. I'm really unsure how to resolve it (no mention of this in GoDaddy's docs) and my domain in question is using default nameservers from GoDaddy.

@alexAubin
Copy link

I'm getting the same kind of issues when trying to create MX and SRV records on godaddy.

I'm suspecting that this is related to the fact that Godaddy's API expects a specific priority fields for MX and SRV records (+ other keys for SRV), c.f. https://developer.godaddy.com/doc/endpoint/domains#/v1/recordReplaceTypeName

(Also Lexicon's test suite doesn't seem to validate that MX / SRV record creation does work for each provider?)

@gprasanth
Copy link

Just found out that, when there is a CNAME record for a subdomain, say for example, support.example.com to somesite.com, and you try to add an MX record for support.example.com to anything.com, I am seeing 422 unprocessable entity error.

@GiviMAD
Copy link
Contributor

GiviMAD commented Dec 17, 2023

I was able to do it applying these changes #1834

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants