I’m using App Platform and have got the following components setup in it:
library
)The Web Service is a simple NodeJS application with a few endpoints in it. I’ve setup App Platform so that the Web Service uses internal ports only, meaning it cannot be accessed from the internet. All of my Functions are exposed to the public internet however and I am able to use Postman to call them.
I’d like to have my Functions call endpoints in my Web Service. Reading the documentation it appears that this should be possible if components belong to the same App Platform, however when my Function attempt to call any Web Service endpoint (example: http://library:{port}/get-books
) it returns Error: getaddrinfo ENOTFOUND library
, implying it cannot reach the endpoints in the Web Service.
Is my approach to call endpoints in the Web Service correct? Or have I misinterpreted the documentation and Functions are not included as components that are able to use the private network?
Documentation referenced:
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!
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.
Hey Eleanor! 👋
I believe that currently, functions can’t use internal networking on the App Platform, so they can’t directly access your internal-only Web Service via
http://library:{port}
.A workaround for this might be to expose the web service publicly and protect it with some form of authentication or authorization.
If internal communication between Functions and Services is a must for your project, you might be able to achieve this using a small internal API Gateway or deploying both components as web services instead of mixing services and functions.
The best thing to do to get your voice heard regarding this would be to head over to the DigitalOcean Product Ideas board and post a new idea, including as much information as possible for what you’d like to see implemented.
- Bobby