I see one has to make sure that the DNS is resolved properly from the machine, check out the node documentation to make sure that domain
I had a similar issue but running as a AWS Lambda function, so in case someone is having this issue with Lambda functions this is how I got it resolved.
I spent a day until I found this fix, hope it helps someone else.