Environment variable validation - warn on leading/trailing whitespace
veezbo
HOBBYOP

2 months ago

Environment variables with accidental leading or trailing whitespace are silently accepted by Railway, which can cause

hard-to-debug deployment failures.

For example, setting NEXT_PUBLIC_API_URL to https://myapp.up.railway.app (with a trailing space) results in the app

making requests to https://myapp.up.railway.app%20/api/endpoint, which fails silently. There's no error in Railway

logs, no build warning, nothing - you just get broken requests in the browser.

This is an easy copy-paste mistake, especially when copying URLs from Railway's own UI. Two low-effort fixes that would

prevent this:

1. Trim whitespace automatically on env var values (arguably the right default - there's almost never a reason for

leading/trailing whitespace in an env var).

2. At minimum, show a warning in the UI if a value contains leading or trailing whitespace, so the user can confirm

it's intentional.

Other platforms (Vercel, Heroku) trim by default. This is a small change that would save users real debugging time.

Under Review

0 Threads mention this feature

0 Replies

Welcome!

Sign in to your Railway account to join the conversation.

Loading...