Skip to content

Fix: Wrap startCommand to expand $PORT variable at runtime - #2

Merged
SyedaRubbani merged 1 commit into
mainfrom
railway/code-change-LQRu8y
Jun 25, 2026
Merged

SyedaRubbani merged 1 commit into
mainfrom
railway/code-change-LQRu8y

Conversation

@railway-app

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

Copy link
Copy Markdown

Problem

Railway executes startCommand in exec form (no shell), so the literal string $PORT is passed directly to uvicorn instead of being expanded to the actual port number. This causes uvicorn to fail immediately with Error: Invalid value for '--port': '$PORT' is not a valid integer.

Solution

Wrapped the startCommand in /bin/sh -c "..." in railway.json so the shell expands $PORT to the real port number before uvicorn receives it. This is the standard fix for any Railway startCommand that references environment variables in Dockerfile-based services.

Changes

  • Modified railway.json

Generated by Railway

@SyedaRubbani
SyedaRubbani merged commit 6d15da4 into main Jun 25, 2026
2 of 3 checks passed
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