Auto / Manual domain generation when creating / deploying a project via public api.

8 months ago

I’m running into an issue with deploying my Next.js app on Railway via the GraphQL API. Here’s what I’ve done so far:

Created a service from my public GitHub repo (ru-dr/yatrazen) using serviceCreate.

Set the PORT=3000 environment variable via variableUpsert.

Redeployed the service with serviceInstanceRedeploy.

Queried the domains endpoint—serviceDomains remains empty.

I’ve also tried manually generating a domain in the dashboard, but I need a fully API‑driven solution (or confirmation of the correct mutation) to assign or retrieve the .up.railway.app URL programmatically.

Could someone point me to the right GraphQL mutation or workflow to provision a domain via the API? Any guidance would be greatly appreciated!

Solved$10 Bounty

2 Replies

8 months ago

f93dfcae-bb75-475d-83d2-fa26eb292c45


8 months ago

Hey, the mutation you're looking for is

mutation ($environmentId: String!, $serviceId: String!) {
  # targetPort is also available but can be omitted if a `port` environment variable is set
  # or if you use the port generated by Railway on your application (PORT env variable)
  serviceDomainCreate(
    input: {environmentId: $environmentId, serviceId: $serviceId}
  ) {
    createdAt
  }
}

Status changed to Solved brody 8 months ago


Loading...