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

Closed
opened 2025-11-20 04:22:42 -05:00 by saavagebueno · 5 comments
Owner

Originally created by @oolmfoo on GitHub (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)

Originally created by @oolmfoo on GitHub (Oct 19, 2023). 1. Is this urgent: Yes 2. DNS provider(s) you use: Porkbun 3. Program version: <!-- See the line at the top of your logs --> `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: ```log 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!**): ```json { "settings": [ { "provider": "porkbun", "domain": "xyz.com", "host": "*", "api_key": "pk1_ff", "secret_api_key": "sk1_ff", "ip_version": "ipv4" } ] } ``` Host OS: Dietpi (Debian)
Author
Owner

@everydaycombat commented on GitHub (Oct 21, 2023):

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

@everydaycombat commented on GitHub (Oct 21, 2023): Same thing with Porkbun for me today but going to try some things.
Author
Owner

@everydaycombat commented on GitHub (Oct 21, 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 commented on GitHub (Oct 21, 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 reading JSON config from file /updater/data/config.json 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>
Author
Owner

@everydaycombat commented on GitHub (Oct 21, 2023):

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

@everydaycombat commented on GitHub (Oct 21, 2023): 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
Author
Owner

@oolmfoo commented on GitHub (Oct 25, 2023):

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

@oolmfoo commented on GitHub (Oct 25, 2023): Following @everydaycombat suggestion, it works after I delete the ALIAS record on Porkbun website.
Author
Owner

@qdm12 commented on GitHub (Jan 18, 2024):

Done in 869b010853 🎉
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.

@qdm12 commented on GitHub (Jan 18, 2024): Done in 869b010853dcf246d549aa50ef7863dc73027e3c 🎉 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 in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ddns-updater#319