Issue with deploy a Turborepo project
Anonymous
PROOP

10 months ago

Project ID(Serivice ID)=>cf9f679d-d447-49bc-be99-0c5cb235f2bc

Project Name(Serivce Name)=>glistening-analysis

My railway.json

{
  "$schema": "https://railway.app/railway.schema.json",
  "name": "WiddyUP2.0 Monorepo",
  "description": "Student Fundraising Platform Monorepo Deployment",
  "monorepo": {
    "root_directory": "./",
    "detect_package_manager": true,
    "services": [
      {
        "name": "WiddyUP tRPC backend API",
        "path": "packages/backend",
        "buildCommand": "pnpm run build",
        "startCommand": "pnpm dev",
        "dependsOn": [],
        "environment": {
          "PORT": "3001"
        }
      },
      {
        "name": "WiddyUP Frontend (using mobile app to represent)",
        "path": "apps/mobile",
        "buildCommand": "pnpm --filter mobile build",
        "startCommand": "pnpm --filter mobile dev",
        "dependsOn": ["WiddyUP tRPC backend API"],
        "environment": {
          "EXPO_PUBLIC_API_URL": "${{services[\"WiddyUP tRPC backend API\"].url}}"
        }
      }
    ]
  },
  "build_environment": {
    "NODE_VERSION": "22.x"
  }
}

I deployed a Turborepo project (Node.js with TypeScript) and encountered an issue. even I use the gitlab is not work.Please give us some help.

Build Logs: https://railway.com/project/cf9f679d-d447-49bc-be99-0c5cb235f2bc/service/3c93d06d-5672-4a13-bf8a-7b85cb872f1f?id=bb656c40-50ea-4490-b4af-44db6b3d129d&

$10 Bounty

6 Replies

Railway
BOT

10 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


idiegea21
HOBBY

10 months ago

Heyy, I think this fails because railway doesn’t know which subdirectory or command to use per service in the monorepo and it's likely defaulting to the root without proper build/start configuration.


idiegea21
HOBBY

10 months ago

To solve this, i think you should create a seperate railway service for each app in your monrepo. And in each of the service settings set the root directory(e.g. packages/backend, apps/mobile), the build command (e.g., pnpm --filter backend build) and the start command (e.g., pnpm --filter backend dev).

You can also add a helper script in your package.json like :

"build:backend": "pnpm --filter backend build",
"start:backend": "pnpm --filter backend dev"

idiegea21

To solve this, i think you should create a seperate railway service for each app in your monrepo. And in each of the service settings set the root directory(e.g. `packages/backend`, `apps/mobile`), the **build command** (e.g., `pnpm --filter backend build`) and the **start command** (e.g., `pnpm --filter backend dev`). You can also add a helper script in your package.json like : ``` "build:backend": "pnpm --filter backend build", "start:backend": "pnpm --filter backend dev" ```

Anonymous
PROOP

10 months ago

I already have the help script. seems like your previous message more helpful.


Railway

Hey there! We've found the following might help you get unblocked faster: - [🧵 Include monorepo root in build environment](https://station.railway.com/questions/include-monorepo-root-in-build-environme-f7bae155) - [🧵 build failed](https://station.railway.com/questions/build-failed-129ef04f) - [🧵 Turborepo typescript apps - can't find /dist/index.js](https://station.railway.com/questions/turborepo-typescript-apps-can-t-find-19c292db) If you find the answer from one of these, please let us know by solving the thread!

Anonymous
PROOP

10 months ago

How to setup up multiple repo with railway.json configuration, any resource or docs with railway? I have not see it.


idiegea21
HOBBY

10 months ago

Okay, i think this should help

https://docs.railway.com/guides/monorepo


Welcome!

Sign in to your Railway account to join the conversation.

Loading...