Issues Deploying Node.js Application to Railway After Database Schema Change

adi-tomar
PRO

a year ago

I am experiencing deployment issues with my Node.js application on Railway after attempting to add a new column to the database. The deployment process fails, and I am unable to get the application running.

Environment:

   Deployment Platform: Railway
   Node.js Version: v21.7.2
   Database: MySQL (hosted on Railway)
   ORM/Database Library: mysql2/promise

Steps to Reproduce:

1.  Added a new column to the Users table in the MySQL database using the following SQL command:

ALTER TABLE Users ADD COLUMN userType ENUM('admin', 'user') NOT NULL DEFAULT 'user';

Observed Behavior:

•   The deployment fails with errors indicating issues related to the port being already in use.
•   The application is unable to bind to the specified port, resulting in deployment failure.

Error Messages:

Error: listen EADDRINUSE: address already in use :::8080
at Server.setupListenHandle as listen2 at listenInCluster (node:net:1945:12) at Server.listen (node:net:2037:7) at Function.listen (/path/to/project/nodemodules/express/lib/application.js:635:24)
at Object. (/path/to/project/index.js:345:5)
at Module.compile (node:internal/modules/cjs/loader:1368:14) at Module.extensions..js (node:internal/modules/cjs/loader:1426:10)
at Module.load (node:internal/modules/cjs/loader:1205:32)
at Module.load (node:internal/modules/cjs/loader:1021:12) at Function.executeUserEntryPoint as runMain Emitted 'error' event on Server instance at: at emitErrorNT (node:net:1924:8) at process.processTicksAndRejections (node:internal/process/taskqueues:82:21) {
code: 'EADDRINUSE',
errno: -48,
syscall: 'listen',
address: '::',
port: 8080
}

View Deploy details

> ⓘ Deployment information is only viewable by project members and Railway employees.

Solved

5 Replies

a year ago

Hey, Are you able to share the code for index.js?


adi-tomar
PRO

a year ago

Thank you for your assistance. I figured it out.


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

I don't think I assisted anything haha.

Would you mind sharing what the issue was?


Status changed to Awaiting User Response Railway about 1 year ago


adi-tomar
PRO

a year ago

I didn't realize I had called my app to listen to the port twice. The port already in use error was coming from that. It was a dumb mistake.


Status changed to Awaiting Railway Response Railway about 1 year ago


a year ago

Ah gotcha, Thanks for sharing.


Status changed to Awaiting User Response Railway about 1 year ago


Status changed to Solved brody about 1 year ago