railway environment new --copy does not duplicate volumes, causing Redis crash in PR environments
markwitt1
PROOP

21 days ago

When creating a PR environment with railway environment new <name> --copy <source-env>, service

configurations and variables are copied, but volumes are not created in the new environment.

This causes services that depend on $RAILWAY_VOLUME_MOUNT_PATH (like Redis) to crash because the

variable is empty, producing malformed config:

*** FATAL CONFIG FILE ERROR (Redis 8.6.0) ***

Reading the configuration file, at line 4

>>> 'dir "--loadmodule" "/usr/local/lib/redis/modules//redisbloom.so"'

wrong number of arguments

Reproduction:

1. Have a staging environment with a Redis service + volume mounted at /data

2. Run railway environment new pr-test --copy <staging-env-id>

3. Redis service in new environment has volumeMounts: [] — no volume created

4. $RAILWAY_VOLUME_MOUNT_PATH is empty, --dir gets no value, Redis fails to start

Expected behavior:

--copy should either:

- Also create volumes in the new environment (matching source mount paths)

- Or document that volumes are NOT copied, so users can add railway volume add as a post-creation

step

Workaround:

After creating the environment, manually add the volume:

railway volume add --mount-path /data --service Redis

Environment: Railway CLI v4.x, Redis 8.6.0 Docker image

Solved

2 Replies

cezary
PRO

21 days ago

I'm observing the same behaviour on my setup.

I'm using GH Actions with

railway link --project ${{ env.RAILWAY_PREVIEW_PROJECT_ID }} \
  --environment ${{ env.RAILWAY_BASE_ENV_ID }} \
  --workspace "${{ env.RAILWAY_WORKSPACE_ID }}"

railway environment new "$ENV_NAME" \
  --duplicate ${{ env.RAILWAY_BASE_ENV_ID }}

20 days ago

Fixed here - https://github.com/railwayapp/cli/pull/795

Available in v4.30.2


Status changed to Awaiting User Response Railway 20 days ago


Railway
BOT

13 days ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 13 days ago


Loading...