Fix Railway deployment failure caused by file-based logging configuration #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The application was failing to deploy on Railway.app due to winston logger attempting to write log files to a
logs/directory that doesn't exist in Railway's ephemeral filesystem. The logger was configured to use file transports in production, which is incompatible with cloud platforms that capture logs from stdout/stderr.Root Cause
Railway.app (and similar cloud platforms) have ephemeral filesystems where:
The existing logger configuration attempted to write to file transports in all environments, causing deployment failures when the
logs/directory couldn't be created or accessed.Solution
Refactored
server/config/logger.jsto use environment-aware logging strategies:Production Mode (Railway, Heroku, etc.):
Development Mode (Local):
logs/directory for persistenceChanges Made
Code
NODE_ENVDocumentation
Testing
✅ Verified logger outputs to console in production mode
✅ Verified logger creates files and logs to console in development mode
✅ Confirmed logs directory auto-creation works correctly
✅ Validated syntax and module imports
✅ Tested all log levels (error, warn, info, http, debug)
Impact
Logs can now be viewed in Railway dashboard under Deployments → Logs.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
binaries.prisma.shnode scripts/postinstall.js(dns block)node /home/REDACTED/work/SpareChair/SpareChair/node_modules/prisma/build/index.js generate --postinstall "UNABLE_TO_FIND_POSTINSTALL_TRIGGER__ENVAR_MISSING"(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.