I have a Node.js timer function (Node.js v18, Linux, Consumption) running at Azure that is failing intermittently, citing what appears to be DNS lookup failures. The function runs every 30 minutes. It will work for several days just fine, and then start failing for 12-24 hours, and then start working again.
Here is the error from the logs. This error occurs when the @hubspot/api-client
library sends a request to the HubSpot API (api.hubapi.com).
Exception: request to https://api.hubapi.com/crm/v3/objects/products?limit=100&after=2663219990&properties=hs_lastmodifieddate%2Chs_sku%2Chs_images&archived=false failed, reason: getaddrinfo EAI_AGAIN api.hubapi.com
Here are a few things I have tried, based on my research:
- Updated the
@hubspot/api-client
dependency to latest version, in case there was an issue with the library. - In the Function App, I changed the Outbound DNS to Custom, listing Cloudflare (1.1.1.1) and Quad9 (9.9.9.9) instead of the default Azure DNS, in case there was an issue with the Azure DNS.
Those two changes didn’t help resolve the issue. This function works well locally, as well as on GCP, where it was deployed previously.