Skip to content
Railway API — Safely resolving an already-applied staged service creation
eddy0007
OP

a month ago

Hello Railway team,

We're looking for clarification about the behavior of Railway's staged-change API.

A project-level service was staged for creation in one environment using:

{
  "services": {
    "EXISTING_SERVICE_ID": {
      "isCreated": true
    }
  }
}

We subsequently called environmentPatchCommit with that exact payload and skipDeploys: true.

The operation succeeded, and subsequent API reads confirm that the service is now applied, empty and has never deployed.

However, an identical creation patch remains in STAGED status.

We'd appreciate clarification on two possible resolutions:

  1. Is environmentPatchCommitStaged(environmentId: ..., skipDeploys: true) safe and idempotent when the service already exists in the target environment? Specifically, will it preserve the existing Service ID, environment-specific instance identity and configuration without replacement, reinitialization or deployment?

  2. Alternatively, is there a supported API or dashboard action to discard only the redundant staged creation without affecting the already-applied service?

Which approach does Railway recommend for this situation?

We're deliberately avoiding trial operations against production.

We're requesting guidance only, not changes to our resources.

Thank you.

$10 Bounty

1 Reply

Status changed to Awaiting Railway Response Railway • about 1 month ago


Railway
BOT

a month ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • about 1 month ago


Anonymous

a month ago

Railway documents a control that discards an individual staged change:

  1. Open the affected environment in the project canvas.
  2. Select Details in the staged-changes banner.
  3. Locate the redundant service-creation entry.
  4. Select the x beside that entry.

Source: https://docs.railway.com/deployments/staged-changes

This is the documented discard operation. It is separate from committing the staged changes. Do not select Deploy for this operation.

Before using that control, check that the entry identifies only the redundant creation. If the interface groups other changes with it, obtain Railway confirmation before proceeding.

For a read-only check, the public API exposes environmentStagedChanges(environmentId: ...). The environment query also exposes service-instance IDs and latestDeployment. Compare those values before and after discarding the entry.

Source: https://docs.railway.com/integrations/api/manage-environments

I found no documented idempotency guarantee for committing an already-applied isCreated patch. The schema describes skipDeploys as skipping deployments. That description does not guarantee preservation of instance identity or configuration. I would not use it as proof that replaying this creation is safe.

AI-assisted answer. I checked the official documentation and CLI schema. I did not access your project or test this duplicate-creation case. A guarantee for that case requires a statement from Railway.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...