dnsimple / dnsimple-node

The DNSimple API client for Node.js.
https://developer.dnsimple.com/
MIT License
47 stars 19 forks source link

client.zones.updateZoneRecord throws error for URI unsafe DNS record content #135

Closed christianechevarria closed 1 year ago

christianechevarria commented 2 years ago

I'm currently using this client to automatically register & update DNS records with MailGun records automatically -

I've been very successful at creating records using the createZoneRecord function but when I've duplicated the code for updateZoneRecord I am getting this error

DNSimple updateSubdomain Error: TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters

I've confirmed that creating new domains with DNS records containing URI unsafe characters such as "/" which is the most prevalent works as expected but createZoneRecord for some reason does not

This is fairly problematic for RSA keys generated as _domainkey records (for DKIM)

Do I have to URI encode the values inside the DNS record "content" properties? If so, why is it necessary to do this for updateZoneRecord but not createZoneRecord (my guess is that this is potentially a bug, but I'm not sure)

dallasread commented 2 years ago

@chrisgereina Thanks for bringing this to our attention!

Upon first glance, I don't see anything that would cause the difference in behaviour between the two methods. I'll review with the team and we'll get back to you.

sbastn commented 2 years ago

👋 @chrisgereina, I know this doesn't answer your question, but could our apply one-click service endpoint help you?

Quick intro: one-click services are DNS snippets ready to be applied to a domain/zone. These are available through our UI and API.

Here is an article that explains how to use the Mailgun one-click service through our UI. Through our API, you would use the list service endpoint to retrieve the Mailgun one-click service, and use this endpoint to apply the one-click service to your domain/zone.

I hope this helps. Are you doing something specific that cannot be done through the one-click service?

Let us know!

jacegu commented 1 year ago

Hey @christianechevarria, thanks for reporting this. It's been a while, but maybe you can provide the call you are making from the client so we can reproduce this? I have tried myself but I have not been able to.

DXTimer commented 1 year ago

Closing as stale. Please respond to this issue to reopen with reproduction steps.