Question

App Platform: Internal communication between a service and a function

I’m using App Platform and have got the following components setup in it:

  • Web Service (called library)
  • 4 Functions

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:


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.

Bobby Iliev
Site Moderator
Site Moderator badge
January 11, 2025
Accepted Answer

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.

https://ideas.digitalocean.com/

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.