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

Bug: Unable to create DNS record - Porkbun API #546

Closed
oolmfoo opened this issue Oct 19, 2023 · 5 comments
Closed

Bug: Unable to create DNS record - Porkbun API #546

oolmfoo opened this issue Oct 19, 2023 · 5 comments

Comments

@oolmfoo
Copy link

oolmfoo commented Oct 19, 2023

  1. Is this urgent: Yes

  2. DNS provider(s) you use: Porkbun

  3. Program version:

    Running version latest built on 2023-10-14T09:56:50.040Z (commit e635b19)

  4. What are you using to run the container: docker run

  5. Extra information (optional)

Logs:

2023-10-19T07:43:12Z INFO reading JSON config from file /updater/data/config.json
2023-10-19T07:43:12Z INFO Found single setting to update record
2023-10-19T07:43:13Z INFO Reading history from database: domain xyz.com host *
2023-10-19T07:43:13Z INFO [healthcheck server] listening on 127.0.0.1:9999
2023-10-19T07:43:13Z INFO [backup] disabled
2023-10-19T07:43:13Z INFO [http server] listening on :8000
2023-10-19T07:43:14Z INFO IPv4 address xyz.com is 12.345.678.900 and your IPv4 address is 123.456.78.910
2023-10-19T07:43:14Z INFO Updating record [domain: xyz.com | host: * | provider: porkbun | ip: ipv4] to use 123.456.78.910
2023-10-19T07:43:16Z ERROR HTTP status is not valid: 400: {"status":"ERROR","message":"Create error: We were unable to create the DNS record."}

Configuration file (remove your credentials!):

{
  "settings": [
    {
      "provider": "porkbun",
      "domain": "xyz.com",
      "host": "*",
      "api_key": "pk1_ff",
      "secret_api_key": "sk1_ff",
      "ip_version": "ipv4"
    }
  ]
}

Host OS: Dietpi (Debian)

@everydaycombat
Copy link

Same thing with Porkbun for me today but going to try some things.

@everydaycombat
Copy link

everydaycombat commented Oct 22, 2023

Alright, I figured this out and it's more on Porkbun's side with the default CNAME and ALIAS records they add for a new domain and how an A record can't be added for the same host. When I tried to add an A record in the web UI it gives this error:
ERROR: Could not add DNS record: A CNAME record with that host already exists.

This is what their API should say instead of Create error: We were unable to create the DNS record.

You can leave the CNAME record but you have to delete the ALIAS record and then there's no problem for ddns-updater to create the A record for you. Hopefully this helps.

The log looked like this for me (with my annotation you'll see):

2023-10-21T18:49:28-06:00 INFO Found single setting to update record
2023-10-21T18:49:28-06:00 INFO Reading history from database: domain <omitted> host @
2023-10-21T18:49:28-06:00 INFO [healthcheck server] listening on 127.0.0.1:9999
2023-10-21T18:49:28-06:00 INFO [backup] disabled
2023-10-21T18:49:28-06:00 INFO [http server] listening on :8000
2023-10-21T18:49:29-06:00 WARN cannot DNS resolve <omitted> after 5 tries: lookup <omitted> on <omitted>: no such host
2023-10-21T18:49:29-06:00 INFO IPv4 address of <omitted> is invalid IP and your IPv4 address is <omitted>
2023-10-21T18:49:29-06:00 INFO Updating record [domain: <omitted> | host: @ | provider: porkbun | ip: ipv4] to use <omitted>
2023-10-21T18:49:30-06:00 ERROR HTTP status is not valid: 400: {"status":"ERROR","message":"Create error: We were unable to create the DNS record."}
***REMOVE THE DEFAULT ALIAS RECORD NOW***
2023-10-21T18:54:29-06:00 WARN cannot DNS resolve <omitted> after 5 tries: lookup <omitted> on <omitted>: no such host
2023-10-21T18:54:29-06:00 INFO IPv4 address of <omitted> is invalid IP and your IPv4 address is <omitted>
2023-10-21T18:54:29-06:00 INFO Updating record [domain: <omitted> | host: @ | provider: porkbun | ip: ipv4] to use <omitted>

@everydaycombat
Copy link

Porkbun's own API docs say The API functionality documented on this page is currently in development. Although certain functionality may be documented it may not neccessarily exist or behave as expected.

So maybe this was working when the Porkbun provider was added in 2021, who knows. I don't think there's much to do in the code unless others think an ALIAS removal should happen before an A record is added.

Tagging @fredericrous and @qdm12 since I figured you'd like to see this

@oolmfoo
Copy link
Author

oolmfoo commented Oct 26, 2023

Following @everydaycombat suggestion, it works after I delete the ALIAS record on Porkbun website.

@qdm12
Copy link
Owner

qdm12 commented Jan 18, 2024

Done in 869b010 🎉
Now if the A/AAAA record does not exist, and there is any ALIAS record for the host.domain, it is first removed then the A/AAAA record is created. This is mentioned in the docs/porkbun.md page, and should not affect existing setups since their records most likely already exist.

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

3 participants