Nixpacks Monorepo: TypeScript Build Artifacts Not Preserved in Deployed Container
maxroebuck1
HOBBYOP

3 months ago

### Detailed Issue Description

Project: primetable (monorepo)

Service: @primetable/scraper

Repository: maxroebuck1/primetable

Region: europe-west4

Problem Summary

TypeScript build commands execute successfully during the build phase, but the compiled dist/ directory is not present in the deployed container, causing immediate crashes on startup.

Evidence of Successful Builds

Deployment ID: 8db0e12e-b9fd-48e0-8542-40dd8555cf28

Build logs show successful compilation:

```

2025-11-24T22:34:40 > @primetable/shared@1.0.0 build

2025-11-24T22:34:40 > tsc

2025-11-24T22:34:41 > @primetable/scraper@1.0.0 build

2025-11-24T22:34:41 > tsc -p tsconfig.json

[No TypeScript errors]

2025-11-24T22:34:44 Downloading Firefox 142.0.1... done

2025-11-24T22:34:49 Firefox downloaded

2025-11-24T22:34:51 Installing dependencies... 159 packages

[All system deps installed successfully]

2025-11-24T22:35:46 exporting to docker image format

2025-11-24T22:37:08 image push progress: 2.4 GB/2.4 GB

```

Build completed successfully without errors.

Evidence of Missing Artifacts

Same deployment runtime logs:

```

2025-11-24T23:10:34 Starting Container

2025-11-24T23:10:34 Error: Cannot find module '/app/packages/scraper/dist/scheduler.js'

at Module._resolveFilename (node:internal/modules/cjs/loader:1420:15)

code: 'MODULE_NOT_FOUND'

```

The dist/scheduler.js file created during build is not present in the deployed container.

Configuration Details

railway.toml:

```toml

[build]

builder = "NIXPACKS"

buildCommand = "pnpm install --frozen-lockfile && pnpm --filter @primetable/shared build && pnpm --filter @primetable/scraper build && cd packages/scraper && npx playwright install firefox && npx playwright install-deps firefox"

[deploy]

startCommand = "cd packages/scraper && node dist/scheduler.js"

restartPolicyType = "ON_FAILURE"

```

Project Structure:

```

/packages/scraper/

├── src/

├── dist/ ← Created by tsc during build, missing in container

├── tsconfig.json

├── package.json

└── scheduler.ts (entry point)

```

What We've Tried

1. white_check_mark emoji Dockerfile approach - same issue

2. white_check_mark emoji Explicit buildCommand in railway.toml - ignored

3. white_check_mark emoji .nixpacks.toml configuration - same issue

4. white_check_mark emoji Recreated service fresh (no cache) - same issue

5. white_check_mark emoji 40+ deployment attempts with various configs

Expected Behavior

The dist/ directory created by tsc during the build phase should be preserved and available in the deployed container at /app/packages/scraper/dist/.

Actual Behavior

Build completes successfully showing TypeScript compilation, but the compiled JavaScript files in dist/ are not included in the final deployed container image.

Question

How can we ensure TypeScript build artifacts from pnpm --filter @primetable/scraper build are preserved in the deployed Nixpacks container for a monorepo GitHub deployment?

API Key (for reference):862yvbXFaUngPz5DxrnfjldfPR1wT1O9FaKsMkmWiSU=

$10 Bounty

2 Replies

Railway
BOT

3 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!


3 months ago

Hey! Just an idea but have you tried using the railway CLI to ssh into the container at runtime and actually confirm that the dist files aren't there?

You'd need to run a process to hold the container up without crashing (could literally be sleep infinity) but after that you should be able to ssh in and poke around to see why things aren't working.

When y'all used a dockerfile, did the dockerfile run okay on your dev machines?


Loading...