Hello, I’m creating architecture where I have one main REST API and few microservices that are doing “hard work” behind the scenes.
On my local environment everything works perfectly, but when I try to set up same architecture on digitalocean apps I get Error: connect ECONNREFUSED
My app spec looks like this:
services:
- build_command: npm run build
environment_slug: node-js
gitlab:
branch: develop
deploy_on_push: true
repo: html-pdf/html-pdf-api
http_port: 8080
instance_count: 1
instance_size_slug: basic-xxs
name: dev-html-pdf-api
routes:
- path: /
run_command: npm run start:prod
source_dir: /
- dockerfile_path: Dockerfile
gitlab:
branch: develop
deploy_on_push: true
repo: html-pdf/html-pdf-microservice
http_port: 8080
instance_count: 1
instance_size_slug: basic-xxs
internal_ports:
- 3000
name: dev-html-pdf-microservice
routes:
- path: /microservice
run_command: npm run start:prod
source_dir: /
so as you can see I’ve enabled 3000 internal port.
About the code, microservice is set up to listen on localhost:3000, and the main api is connecting to it using options:
options: {
host: 'dev-html-pdf-microservice',
port: 3000,
}
Unfortunately I get Error: connect ECONNREFUSED 10.245.138.142:3000. I’ve tried many other options with different options on api and microservice but same result.
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.
Hello, thanks for trying DigitalOcean App Platform. Services running on app platform must bind to and expose the HTTP port on the network interface
0.0.0.0
rather thanlocalhost
interface. This is true for both the internaldev-html-pdf-microservice
service and the externaldev-html-pdf-api
service. The connection to the internal private service looks correct, so hopefully this is just the service binding issue.