Fix dns_arvan: Correct API usage for domain lookup and improve error handling#6789
Fix dns_arvan: Correct API usage for domain lookup and improve error handling#6789abooraja wants to merge 11 commits intoacmesh-official:devfrom
Conversation
- Fix _get_root() to fetch domains list first, then search within response - Fix _arvan_rest() GET request handling - Improve dns_arvan_rm() with multiple pattern matching - Enhance error handling and debug output - Fixes acmesh-official#6788
|
Welcome |
|
✅ I have read the DNS API Dev Guide: https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Dev-Guide ✅ I have read the DNS-API-Test guide: https://github.com/acmesh-official/acme.sh/wiki/DNS-API-Test ✅ I understand that the DNS-API-Test must pass before the code can be reviewed. ✅ I will update the wiki documentation at: https://github.com/acmesh-official/acme.sh/wiki/dnsapi2 Status:
Testing:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes critical issues with the ArvanCloud DNS API integration that was causing certificate issuance failures. The main problem was incorrect API usage where the code was trying to query individual domains directly via /domains/{domain}, which isn't supported by ArvanCloud API v4.0. The fix implements the correct approach of listing all domains first and then searching through the list.
Changes:
- Refactored
_get_root()to fetch complete domain list first, then search through it with robust JSON parsing - Fixed
_arvan_rest()to properly handle GET requests without appending data to URLs, and added direct exit code checking - Enhanced error handling throughout with better error messages and multiple fallback patterns for JSON extraction
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dnsapi/dns_arvan.sh
Outdated
| if ! printf "%s" "$response" | grep \"current_page\":1 >/dev/null; then | ||
| if ! printf "%s" "$response" | grep -q "\"current_page\":1"; then | ||
| _err "Error on Arvan Api" | ||
| _err "Please create a github issue with debbug log" |
There was a problem hiding this comment.
This error message contains a typo: "debbug" should be "debug".
| _err "Please create a github issue with debbug log" | |
| _err "Please create a github issue with debug log" |
|
you need to run the dns api test on your repo, not here. |
….sh) Co-authored-by: Cursor <cursoragent@cursor.com>
Problem
The
dns_arvanDNS API was failing with "invalid domain" error when trying to obtain SSL certificates for domains. The issue was caused by incorrect API usage:_get_root()function: Was attempting to query/domains/{domain}directly, which is not supported by ArvanCloud API v4.0. The API requires listing all domains first, then searching through the list._arvan_rest()function: Was incorrectly appending data to GET request URLs and had improper error handling.Shellcheck compliance: The code had SC2181 style issues with exit code checking.
Solution
Changes Made:
Refactored
_get_root()function:/domainsendpoint firstdomain_idusing multiple robust regex patterns to handle different JSON response formatsFixed
_arvan_rest()function:ARVAN_API_URL/$epwhen endpoint is provided, orARVAN_API_URLfor listing domainsEnhanced
dns_arvan_add()function:Enhanced
dns_arvan_rm()function:record_idfor deletionCode quality:
Testing
mizekar.siteand*.mizekar.siteAPI Documentation
Based on ArvanCloud API v4.0 documentation:
Related
Fixes #<ISSUE_NUMBER>
Checklist