a year ago
I recently switched to V2 and every since, I'm not able to deploy my express server. I am using PM2, primarily for it's load balancing functionality with API clusters. The error I receive indicates that multiple servers are trying to run on the same port:
7|Web API | info: š£ Starting exchange-service API server on 8080 {"deployment_id":"deployment-4d8dfc38-7d69-4424-bf33-ff5d88d3c912","railway_replica_id":"5d4a1b5c-df9d-4e11-8972-cf570d113fa1"}
6|Web API | (Use `node --trace-warnings ...` to show where the warning was created)
6|Web API | Internal error emitted on the WebSocket server. Please check your implementation. Error: bind EADDRINUSE null:8080
6|Web API | at listenOnPrimaryHandle (node:net:1885:18)
Stopping ContainerI'm guessing the different instances from pm2 are somehow competing for the same port causing this issue. Any ideas on what a solution might be?
12 Replies
a year ago
do you have pm2 set to run multiple services?
a year ago
for my own ref -
This is the PM2 settings for the service in question:
module.exports = {
apps: [
{
name: 'Web API',
script: './.build/scripts/runApi.js',
instances: process.env.WEB_API_CLUSTER_INSTANCES ?? '8',
exec_mode: 'cluster',
watch: ['.'],
env: {
UV_THREADPOOL_SIZE: 32,
},
},
],
}One service split into multiple instances using cluster mode
Can we switch back to legacy if this isn't resolved soon? need to get out deployments back out?
a year ago
Legacy has long since been deprecated, I would recommend foregoing pm2 and use our replicas to horizontally scale out your application
a year ago
our public proxy will randomly distribute incoming requests to all the replicas
a year ago
yeah, it's always best to use platform privatives!
a year ago
!s
Status changed to Solved brody ⢠11 months ago