-
Notifications
You must be signed in to change notification settings - Fork 471
VERCEL: Implement Vercel DNS Provider (#3379) #3542
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
Conversation
3b730b1 to
ca579b7
Compare
|
Just an update, I have finished implementing the provider. I will create an intergration test case later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, Vercel has some automatically created records (like immutable NS, automatically created CAA records, etc.) that can not be deleted. How do I implement this?
Also, Vercel enforces a minimum TTL of 60, how do I incorporate that? Done in GetZoneRecordsCorrections.
That's an interesting problem. Luckily we've seen this before. It should be a simple matter of "pretend those records don't exist". Then everything else should "just work" because you are using diff2.ByRecord() and future add/change/deletes will not affect the existing records. Hope that helps! |
tlimoncelli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For someone "not familiar with Go at all" this is quite excellent! I only had a couple minor suggestions!
@tlimoncelli Thanks! I have implemented this in I do notice that when running the intergration tests, there is a Maybe I should return |
|
Also, I noticed that the Vercel API has somewhat strict API rate limiting, something like 50 modifications/deletions per minute, 100 creations per minute, and 500 records retrieval per minute. That would be enough for small/personal domains (Vercel's DNS is not meant for serious deployment anyway), but how would I finish intergration tests though? |
That's an interesting problem. In the short term, we can just run the integration tests a few at a time using the In the long term, we should detect the error that Vercel gives when we hit the limit, sleep, then try again. There are some modules that can help with that. Some providers code their own, others use github.com/failsafe-go/failsafe-go |
2b1a799 to
e981087
Compare
I ended up skipping the pager test, as the preparation (creating 101 records) needs an hour, which is way too much. Vercel, in the end, is not a serious DNS provider, and I have already ensured that I have handled the pagination. On the other hand, I copied and modified the rate limit implementation from Hetnezer's provider, as it behaves mostly the same as Vercel's API, and can easily be ported. |
Sounds good! (Many providers skip the "pager" tests for similar reasons) Tom |
|
Currently, I am failing Update: I implemented a custom rejectif for this. A unit test is also created. |
c9ca0eb to
26c8aed
Compare
|
Also, it turns out that vercel limits CAA with extra fields. They only allow I don't want to deal with this for now, so I have implemented a custom rejectif Also, all integration tests are now passed on my machine locally. |
|
The PR should be ready for review now. Thanks @tlimoncelli for the massive help!
Also, having been playing around with my provider with my production domain already, it works so far:
|
providers/vercel/request.go
Outdated
| retry, err := rl.handleResponse(resp) | ||
|
|
||
| if err != nil { | ||
| resp.Body.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use defer resp.Body.Close() if suitable, optional suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did update to use defer, not sure if it is ok though. cc @tlimoncelli what do you think?
nekomeowww
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM.
tlimoncelli
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run bin/generate.sh to fix the formatting of integrationTest/profiles.json.
Done in |
1c3c1e1 to
ce21c2a
Compare
|
@tlimoncelli Hi, I have just rebased my PR against the latest main branch and resolved all the conflicts. |
|
Thank you for contributing this provider! I'll merge it shortly. I'd love to have Vercel part of the automated testing that we do. If you can arrange for a test account, I'd gladly add it. Instructions are here: https://docs.dnscontrol.org/developer-info/byo-secrets#donate-secrets-to-the-project |
Sure! I would like to create a new draft PR to see if the intergration tests pass from my forked repo first, and I can donate those credentials after that. |
perfect! |
Made a few mistakes when creating the initial version of the docs back in #3542 Fix typos, adjust a few wordings, descriptions, etc. Co-authored-by: Tom Limoncelli <6293917+tlimoncelli@users.noreply.github.com>
The PR follows #3542 Found some bugs when running intergration tests locally again, and the PR is an attempt to fix them: - When updating/creating HTTPS/SRV records, Vercel API only reads from the corresponding struct (either `srv` or `https`). If we provide a `value`, the Vercel API will reject with an error. - The PR makes `Value` "nil-able", and sets `Value` to nil when dealing with `SRV` or `HTTPS` records. - When updating a record, currently, we treat the empty SVC param as omitting the field. But with Vercel's API, omitting a field means not updating the field. We need to explicitly make the field an empty string to create/update an empty SVC param, and the PR does that. - Vercel implements an unknown `ech=` parameter validation process for HTTPS records. The validation process is unknown, undocumented, thus I can't implement a `rejectif` for `AuditRecord`. - Let's make this a known caveat, describe it in the provider docs, skip these intergration tests, and move on. Please tag this PR w/ `provider-VERCEL`.


#3379
The PR is still WIP.The PR is now ready for review.Also, I am not familiar with Go at all. All kinds of reviews are welcome.
Please create the GitHub label 'provider-VERCEL'