qdm12 / ddns-updater

Container to update DNS records periodically with WebUI for many DNS providers

Home Page:https://hub.docker.com/r/qmcgaw/ddns-updater/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Porkbun Unable to Update IP - HTTP Error Code 400

NaturalCarr opened this issue · comments

Greetings gdm12, I've run into the same problem that another user had on issue 536: #536

Here's a copy of that info for context (my issue is exactly the same)

I am using porkbun as my domain registrar.

I'm trying to add two subdomains, one is working, one is not.

{
	"settings": [
		{
          "provider": "porkbun",
		  "domain": "my.site",
		  "host": "[subdomain1], [subdomain2], ... [subdomain7]",
		  "api_key": "pk1_...",
		  "secret_api_key": "sk1_...",
		  "ip_version": "ipv4"
		}
	]
}

The one that is not working "throws" a "Failure (HTTP status is not valid: 400: {"status":"ERROR","message":"Edit error: We were unable to edit the DNS record."}), 3s ago" in the webui.

Any ideas what could be wrong?

When i delete the domain via porkbun, the first registration works, but when trying to update, the error occurs.


I tried to put my docker into log-level debug to give logs with this, but I recieve this error when I do

2024-04-05T06:52:58-04:00 ERROR /updater/data/updates.json validation error: host is empty: for record 10 of 10 with domain my.site

IT would appear I spoke to soon on the 2nd error, I deleted the updates.json so the error logging isn't an issue. Here's my logs with the sensitive stuff redacted

2024-04-05T07:05:15-04:00 INFO Updating record [domain: my.site | host:  request | provider: porkbun | ip: ipv4] to use 100.0.000.000
2024-04-05T07:05:15-04:00 DEBUG POST https://porkbun.com/api/json/v3/dns/retrieveByNameType/my.site/A/%20request | headers: Content-Type: application/json; Accept: application/json; User-Agent: DDNS-Updater quentin.mcgaw@gmail.com | body: {"secretapikey":"sk1"}
2024-04-05T07:05:15-04:00 DEBUG 200 OK | headers: Referrer-Policy: origin; Expires: Thu, 19 Nov 1981 08:52:00 GMT; Cache-Control: no-store, no-cache, must-revalidate; X-Xss-Protection: 1; mode=block; Content-Type: application/json; Set-Cookie: AWSALB=56B9l4gI+OXbtry0S3ddumIJSPCG/QZtZLH67kRpBR5Dac1B5bDgk9D6iRGqtB0Nt/31KApgWseDSjBqfr/HO+ApDxMJc0kUR13HGN+Vx7XTgYq4ioGfv03bQUe8; Expires=Fri, 12 Apr 2024 11:05:15 GMT; Path=/,AWSALBCORS=56B9l4gI+OXbtry0S3ddumIJSPCG/QZtZLH67kRpBR5Dac1B5bDgk9D6iRGqtB0Nt/31KApgWseDSjBqfr/HO+ApDxMJc0kUR13HGN+Vx7XTgYq4ioGfv03bQUe8; Expires=Fri, 12 Apr 2024 11:05:15 GMT; Path=/; SameSite=None; Secure,BUNSESSION2=oZVzti2u1np%2CLHclQrPuGm2CZz8VFQXV5XrwgcVhTwFAWlAI; path=/; secure; HttpOnly; SameSite=Lax; Content-Language: en-US, en; X-Content-Type-Options: nosniff; Server: openresty; Strict-Transport-Security: max-age=63072000; includeSubDomains; preload; X-Frame-Options: sameorigin; Date: Fri, 05 Apr 2024 11:05:15 GMT; Pragma: no-cache | body: {"status":"SUCCESS","cloudflare":"enabled","records":[]}
2024-04-05T07:05:15-04:00 DEBUG POST https://porkbun.com/api/json/v3/dns/retrieveByNameType/my.site/ALIAS/%20request | headers: User-Agent: DDNS-Updater quentin.mcgaw@gmail.com; Content-Type: application/json; Accept: application/json | body: {"secretapikey":"sk1_daff177165207fd4f2e4b49af757f19802df2309fcd3b4ab7e9be074ac33e7fa","apikey":"pk1_d1d927d267dfc21b9a6839d50225caa1a85a42e0739fab39622aaafbfa3c6055"}
2024-04-05T07:05:16-04:00 DEBUG 200 OK | headers: Set-Cookie: *mycookie*; Expires=Fri, 12 Apr 2024 11:05:15 GMT; Path=/,*mycookie*; Expires=Fri, 12 Apr 2024 11:05:15 GMT; Path=/; SameSite=None; Secure,BUNSESSION2=gQPnB4DJHqXuaLPu1PjZEJRu54H1MFSidmxBWPfDg3Qk7Fk-; path=/; secure; HttpOnly; SameSite=Lax; Referrer-Policy: origin; Expires: Thu, 19 Nov 1981 08:52:00 GMT; X-Xss-Protection: 1; mode=block; Pragma: no-cache; Strict-Transport-Security: max-age=63072000; includeSubDomains; preload; X-Frame-Options: sameorigin; X-Content-Type-Options: nosniff; Date: Fri, 05 Apr 2024 11:05:16 GMT; Content-Type: application/json; Server: openresty; Cache-Control: no-store, no-cache, must-revalidate; Content-Language: en-US, en | body: {"status":"SUCCESS","cloudflare":"enabled","records":[]}
2024-04-05T07:05:16-04:00 DEBUG POST https://porkbun.com/api/json/v3/dns/create/my.site | headers: Accept: application/json; User-Agent: DDNS-Updater quentin.mcgaw@gmail.com; Content-Type: application/json | body: {"secretapikey":"sk1_daff177165207fd4f2e4b49af757f19802df2309fcd3b4ab7e9be074ac33e7fa","apikey":"pk1_d1d927d267dfc21b9a6839d50225caa1a85a42e0739fab39622aaafbfa3c6055","content":"108.6.132.241","name":" request","type":"A","ttl":"0"}
2024-04-05T07:05:17-04:00 DEBUG 400 Bad Request | headers: Expires: Thu, 19 Nov 1981 08:52:00 GMT; Cache-Control: no-store, no-cache, must-revalidate; Strict-Transport-Security: max-age=63072000; includeSubDomains; preload; Content-Type: application/json; Set-Cookie: AWSALB=I5LlpKn/aeOQ5kplBPBRKkqDR1XGFHAnZYKPkUrZe7unQtgb/13kcDEyInJol93ihKbzEhEc0ryt2Nn5DlvnJw8RfEbxgyZTEXts8NKeG15AyPOC883kECDSJ04C; Expires=Fri, 12 Apr 2024 11:05:16 GMT; Path=/,AWSALBCORS=I5LlpKn/aeOQ5kplBPBRKkqDR1XGFHAnZYKPkUrZe7unQtgb/13kcDEyInJol93ihKbzEhEc0ryt2Nn5DlvnJw8RfEbxgyZTEXts8NKeG15AyPOC883kECDSJ04C; Expires=Fri, 12 Apr 2024 11:05:16 GMT; Path=/; SameSite=None; Secure,BUNSESSION2=5lwmnkAm9J5hz0zd4RNV0omRzSIntJpHDpOtKWeZqHPJQL9S; path=/; secure; HttpOnly; SameSite=Lax; Pragma: no-cache; Date: Fri, 05 Apr 2024 11:05:17 GMT; Server: openresty | body: {"status":"ERROR","message":"Create error: We were unable to create the DNS record."}
2024-04-05T07:05:17-04:00 ERROR creating record: HTTP status is not valid: 400: Create error: We were unable to create the DNS record.

They mention "no-cache" which i believe may be a setting I enabled on nginx, I'll check my configs and see.

I've done a bit of testing, changing my cache settings to default didn't resolve the issue. I did notice that the first host in my subdomain list will always work properly, it's every domain after that does not. I imagine"*" would work, but I want to have any requests to an improper url blocked.

Confirming, using wildcard works perfectly, it's multiple subdomains that causes this error

⚠️ careful you are exposing your keys in the debug logs above, please change the values (unless they are changed already) renew your keys on Porkbun.

There seems to be discrepancy in your errors, one from your logs says ERROR creating record: HTTP status is not valid: 400: Create error: We were unable to create the DNS record. and the original one is Edit error: We were unable to edit the DNS record. so which one is the one you are having a problem with?

Now, regarding the URL it's hitting https://porkbun.com/api/json/v3/dns/retrieveByNameType/my.site/A/%20request this seems rather odd, what are your subdomains? It's meant to be of the form

https://porkbun.com/api/json/v3/dns/retrieveByNameType/domain/recordType/host if the host is not @.

So the %20request I have no idea where it's from. Are you sure you don't have a space in your subdomain field value?

From the looks of it, it tries to list records for domain my.site, type A and subdomain %20request, to which Porkbun responds with no record found. So the program then tries to create domain my.site which fails, likely because it already exists.

Also, please provide necessary details such as program version, what are you using the run the program.

I think changing "host": "[subdomain1], [subdomain2], ... [subdomain7]", to "host": "[subdomain1],[subdomain2],...,[subdomain7]" would fix it, because %20` is the url escaped value for space.
I've added code in ae4ab39 to trim spaces for each host, to prevent such issue to re-occur as well.

Thank you! I thought I removed those references to the key, its been changed on Porkbun. I tried both of these,

Swapping to "host": "[subdomain1],[subdomain2],...[subdomain7]"

worked perfectly!

For some extra context, I was running this as a docker on Unraid