Skip to content

fix: wrap startCommand in railway.toml with sh -c for $PORT expansion - #1

Open
railway-app[bot] wants to merge 2 commits into
mainfrom
railway/code-change-FmVJhh
Open

fix: wrap startCommand in railway.toml with sh -c for $PORT expansion#1
railway-app[bot] wants to merge 2 commits into
mainfrom
railway/code-change-FmVJhh

Conversation

@railway-app

@railway-app railway-app Bot commented Jun 4, 2026

Copy link
Copy Markdown

Problem

Railway runs the startCommand from railway.toml in exec form for Dockerfile deployments, which bypasses shell variable expansion. The literal string $PORT was passed directly to uvicorn's --port flag, causing it to crash immediately with Error: Invalid value for '--port': '$PORT' is not a valid integer, failing every healthcheck.

Solution

Wrapped the startCommand in /bin/sh -c so the shell expands $PORT before uvicorn receives it, and switched to ${PORT:-8000} to provide a safe fallback for local development. This matches the pattern already used in the Dockerfile CMD.

Changes

  • Modified railway.toml

Generated by Railway

railway-app Bot and others added 2 commits June 4, 2026 11:59
railway.toml startCommand overrides Dockerfile CMD
shell wrapper required for \$PORT variable expansion
fallback to 8000 for local runs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant