Error: getaddrinfo EAI_AGAIN login.usw2.pure.cloud login.usw2.pure.cloud:443

We are currently using the Oauth client credentials workflow to get an access token for our API requests. Once we retrieve the access token we store it in memory on our server until the expiry time after which we request a new token. Intermittently (like 3-5 times a week) we will get the following error:
Error: getaddrinfo EAI_AGAIN login.usw2.pure.cloud login.usw2.pure.cloud:443

Any ideas why we are getting this error or the best way to handle it? I'm thinking of adding logic to retry the request a couple of times if it fails but I'd rather get to the root cause of this issue.

let options = {
		method: 'POST',
		url: 'https://login.usw2.pure.cloud/oauth/token',
		headers:
	{
		'Content-Type': 'application/x-www-form-urlencoded',
		Authorization: 'Basic ' + Buffer.from(clientId + ':' + clientSecret).toString('base64'),
		'Host': 'login.usw2.pure.cloud'
	},
		form:
	{
		'grant_type': 'client_credentials'
	}

Hi Joshua,

It appears that EAI_AGAIN is an error that occurs when the DNS fails to resolve.
Reasons for this could be

  1. Lost connection to DNS server
  2. Incorrect DNS settings
  3. Disconnection from the internet
  4. Proxy issues

Implementing retries would be a good way of handling the error but I agree that getting to the root cause would be best. I would suggest looking into some of the reasons I've outlined above to see if you can find a root cause.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.