Issues Deploying Node.js Application to Railway After Database Schema Change
adi-tomar
PROOP

2 years 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] (node:net:1897:16)

at listenInCluster (node:net:1945:12)

at Server.listen (node:net:2037:7)

at Function.listen (/path/to/project/node_modules/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] (node:internal/modules/run_main:142:12)

Emitted 'error' event on Server instance at:

at emitErrorNT (node:net:1924:8)

at process.processTicksAndRejections (node:internal/process/task_queues: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

2 years ago

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


adi-tomar
PROOP

2 years ago

Thank you for your assistance. I figured it out.


Status changed to Awaiting Railway Response Railway almost 2 years ago


2 years ago

I don't think I assisted anything haha.

Would you mind sharing what the issue was?


Status changed to Awaiting User Response Railway almost 2 years ago


adi-tomar
PROOP

2 years 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 almost 2 years ago


2 years ago

Ah gotcha, Thanks for sharing.


Status changed to Awaiting User Response Railway almost 2 years ago


Status changed to Solved brody almost 2 years ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...