惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
爱范儿
爱范儿
MongoDB | Blog
MongoDB | Blog
腾讯CDC
aimingoo的专栏
aimingoo的专栏
月光博客
月光博客
Engineering at Meta
Engineering at Meta
C
Check Point Blog
N
Netflix TechBlog - Medium
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LangChain Blog
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
WordPress大学
WordPress大学
博客园 - 司徒正美

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
# 5 Railway.io Config Mistakes That Silently Break Deploy...
jason rauch · 2026-05-06 · via DEV Community

If you've used Railway.io for more than a week, you've probably experienced the special frustration of a deployment that looks like it worked — green checkmark, no errors — but your app is completely unreachable. No traffic. No response. Just silence.

Most of the time it comes down to a config mistake that Railway doesn't loudly flag. Here are the five that get developers most often, with exact fixes for each.


1. Hardcoding the PORT

This is the #1 Railway gotcha and it catches almost everyone at least once.

Railway injects a $PORT environment variable dynamically at runtime. Your app must read and listen on that port. If you hardcode port 3000 or 8080, your service starts fine but never receives traffic — Railway is sending requests to a port your app isn't listening on.

Broken:

{
  "variables": {
    "PORT": "3000"
  }
}

Enter fullscreen mode Exit fullscreen mode

Setting PORT as a static variable doesn't help — Railway's injected value overrides it anyway.

Fixed — in your app code:

const port = process.env.PORT || 3000;
app.listen(port);

Enter fullscreen mode Exit fullscreen mode

Fixed — in a Dockerfile:

# Don't do this:
EXPOSE 3000

# Do this — let Railway set the port at runtime:
CMD ["node", "server.js"]
# And in server.js: app.listen(process.env.PORT)

Enter fullscreen mode Exit fullscreen mode

This applies to every language and framework. Python with Flask, Go with net/http, Ruby with Puma — they all need to bind to process.env.PORT (or the equivalent env var read in your language).


2. Using an Invalid Builder Value

Railway supports four builders: nixpacks, dockerfile, heroku, and railpack. That's it. If you write anything else — "node", "auto", "docker" — Railway either ignores it or fails silently.

Broken:

{
  "build": {
    "builder": "node"
  }
}

Enter fullscreen mode Exit fullscreen mode

Fixed:

{
  "build": {
    "builder": "nixpacks"
  }
}

Enter fullscreen mode Exit fullscreen mode

If you're using Railway's newer Metal infrastructure, you're likely moving to Railpack (the successor to Nixpacks). In that case, use a railpack.json file with the correct providers array instead:

{
  "$schema": "https://schema.railpack.com",
  "providers": ["node"],
  "deploy": {
    "startCommand": "node server.js"
  }
}

Enter fullscreen mode Exit fullscreen mode


3. No Restart Policy — Crashed Services Stay Down

By default, if your service crashes Railway won't automatically restart it. You need to explicitly set restartPolicyType.

Broken (service stays dead after a crash):

{
  "deploy": {
    "startCommand": "node server.js"
  }
}

Enter fullscreen mode Exit fullscreen mode

Fixed:

{
  "deploy": {
    "startCommand": "node server.js",
    "restartPolicyType": "ON_FAILURE"
  }
}

Enter fullscreen mode Exit fullscreen mode

Valid values are ON_FAILURE, ALWAYS, and NEVER. For most production services you want ON_FAILURE. Using ALWAYS means Railway will restart even intentional shutdowns — usually not what you want.


4. Missing or Broken healthcheckPath

If you define a healthcheckPath, it must start with a /. If it doesn't, Railway either rejects the config or the health check never passes — causing your service to restart in a loop.

Broken:

{
  "deploy": {
    "healthcheckPath": "health"
  }
}

Enter fullscreen mode Exit fullscreen mode

Fixed:

{
  "deploy": {
    "healthcheckPath": "/health"
  }
}

Enter fullscreen mode Exit fullscreen mode

Also make sure that route actually exists in your app and returns a 200 status. A common mistake is defining /health in the config but forgetting to add the route handler in the code.

If you're not ready to implement a health endpoint, remove the healthcheckPath field entirely rather than leaving it broken — Railway will fall back to basic process monitoring.


5. npm install Instead of npm ci in Build Steps

This one is subtle but causes non-deterministic builds — meaning your app works locally and in one deployment but breaks in the next.

npm install can silently upgrade packages within the ranges defined in package.json. npm ci installs exactly what's in your package-lock.json — no surprises.

Broken (nixpacks.toml):

[phases.install]
cmds = ["npm install"]

Enter fullscreen mode Exit fullscreen mode

Fixed:

[phases.install]
cmds = ["npm ci"]

Enter fullscreen mode Exit fullscreen mode

Broken (railpack.json):

{
  "steps": {
    "install": {
      "cmds": ["npm install"]
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

Fixed:

{
  "steps": {
    "install": {
      "cmds": ["npm ci"]
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

Same rule applies to Dockerfiles — RUN npm ci instead of RUN npm install.


Catching These Automatically

These five mistakes are easy to make and annoying to debug because Railway doesn't always give you a clear error message. I got tired of finding them manually so I built Railway DevTools — paste your config and Claude AI audits it instantly, flags issues by severity, and shows you the exact fix.

It supports railway.json, railway.toml, Dockerfile, nixpacks.toml, railpack.json, and Procfile. Free to try with no sign-up.


Summary

Mistake Symptom Fix
Hardcoded PORT App unreachable Read process.env.PORT
Invalid builder Build fails silently Use nixpacks, dockerfile, or heroku
No restart policy Crashed service stays down Set restartPolicyType: ON_FAILURE
Bad healthcheckPath Restart loop Start path with /
npm install vs npm ci Non-deterministic builds Use npm ci

If you've run into other Railway gotchas that aren't on this list, drop them in the comments — I'll add them to the article and potentially to the validator too.