Build Fails when trying to get system ENV Variables

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
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: ''
osdm-api | 08:46:54 }

I’m using $_self.PUBLIC_URL to grab the URL at build time. I’m able to get PRIVATE_PORT & PUBLIC_ROUTE_PATH without any issue.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

It looks like you’re application code is trying to run a getaddrinfo call against the string “”. 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.