I’m attempting to use the App platform to deploy a GraphQL API made with Apollo Server as a web service. When Adding in System ENV vars, I get this error message:

Error: getaddrinfo ENOTFOUND https://osdm-api-r44fl.ondigitalocean.app/api
osdm-api | 08:46:54     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26)
osdm-api | 08:46:54 Emitted 'error' event on Server instance at:
osdm-api | 08:46:54     at GetAddrInfoReqWrap.doListen [as callback] (net.js:1499:12)
osdm-api | 08:46:54     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:17) {
osdm-api | 08:46:54   errno: 'ENOTFOUND',
osdm-api | 08:46:54   code: 'ENOTFOUND',
osdm-api | 08:46:54   syscall: 'getaddrinfo',
osdm-api | 08:46:54   hostname: 'https://osdm-api-r44fl.ondigitalocean.app/api'
osdm-api | 08:46:54 }

I’m using $self.PUBLICURL to grab the URL at build time. I’m able to get PRIVATEPORT & PUBLICROUTE_PATH without any issue.

edited by KFSys

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

It looks like you’re application code is trying to run a getaddrinfo call against the string “https://osdm-api-r44fl.ondigitalocean.app/api”. getaddrinfo expects a clean hostname (without the https:// prefix and /api route). You may want the ${APP_DOMAIN} binding instead of $APP_URL or ${service.PUBLIC_URL}.

If you’re trying to determine which addressed to bind your service to, you should be able to use “$PORT” which listens on all interfaces, and selects the port based on the $PORT variable which is passed in.

Submit an Answer