Build Succeeds, Deployment Fails Silently - No Error Logs
davidortsac
HOBBYOP

2 months ago

Need help with this! Build phase gets stuck during the image push step and never completes. The compilation succeeds (yarn install, yarn build both complete), but the final image push hangs at 833-834MB and never finishes. This has persisted for several hours across 20+ deployment attempts.

Project: reviewerV2 / production

Service: Next.js 13.4.12

Node: 22.x

Builder: NIXPACKS v1.41.0

Package Manager: yarn

## Configuration (railway.toml)

```toml

[build]

builder = "NIXPACKS"

[build.nixpacksConfig]

nodeVersion = "22"

[build.env]

NODE_VERSION = "22"

NIXPACKS_NODE_VERSION = "22"

[deploy]

startCommand = "yarn run start"

healthcheckPath = "/"

healthcheckTimeout = 300

restartPolicyType = "ON_FAILURE"

restartPolicyMaxRetries = 10

```

## Build Logs - Hangs at Image Push

```

Nixpacks v1.41.0

║ setup │ nodejs_22, yarn-1_x, chromium

║ install │ yarn install --frozen-lockfile

║ build │ yarn run build

║ start │ yarn run start

white_check_mark emoji yarn install: Done in 69.07s

white_check_mark emoji yarn run build: Done in 87.42s

pause_button emoji exporting to docker image format: 21s

pause_button emoji image push: 833.6 MB / 833.6 MB [STUCK - NEVER COMPLETES]

```

Dependencies install correctly, Next.js compilation completes successfully, but the final image push to Railway's registry hangs indefinitely at 833-834MB and never finishes. The build never progresses past this point.

## Deploy Logs - Never Reached

Deployment phase is never reached because the build hangs during image push. The 833-834MB container image appears to be too large or encounters an issue during upload to Railway's registry, causing the build to hang indefinitely.

## Key Observations

1. Image push phase: 100% hang rate - consistently gets stuck at 833-834MB during image push to registry

2. Image size: Container image is 833-834MB, which seems unusually large

3. No timeout: The build doesn't timeout or fail, it just hangs indefinitely at the image push step

4. No error message: No error is thrown, the progress bar shows "833.6 MB / 833.6 MB" and stays there

## Troubleshooting Attempted (20+ Deployments)

### Attempt 1-5

- Switched between npm and yarn (both result in same 833MB image hang)

- Regenerated package-lock.json multiple times

- Added .npmrc with legacy-peer-deps=true for @langchain/community peer dependency conflicts

- Restored yarn.lock from previously working commit

### Attempt 6-10

- Added explicit startCommand = "yarn run start" to railway.toml

- Configured health check with 300s timeout on "/"

- Added/removed explicit Node version specifications

- Modified railway.toml build environment variables

- Adjusted nixpacksConfig settings

### Attempt 11-15

- Added @next/swc-linux-x64-gnu@13.4.12 as optionalDependency to prevent download during build

- Resolved @langchain/community peer dependency conflicts (firebase-admin version mismatch)

- Upgraded canvas from 2.11.2 to 3.2.0 for Node 22 compatibility

- Verified all environment variables are correctly set in Railway dashboard

### Attempt 16-20

- Added export const dynamic = 'force-dynamic' to root layout to prevent Firebase Auth prerender errors

- Lazy-initialized all Stripe instances to avoid build-time errors

- Adjusted next.config.js serverComponentsExternalPackages

### Attempt 21-25

- Created .dockerignore to exclude documentation, IDE files, git files

- Attempted to delete .next/cache (450MB) after build in package.json build script (failed - files locked)

- Created nixpacks.toml with custom build commands to delete cache with delay

- Tried excluding various directories and files

- Result: Image remains 833-834MB, push still hangs at this size

## The Questions

1. Why does the push hang at 833MB? Size limit? Registry problem? What specifically fails?
2. What is the actual size limit? If 833MB is too large, what's the limit and why isn't it enforced with a clear error?
3. Why no timeout? Push hangs forever. Where's the timeout mechanism? After 25 attempts with every possible configuration change, the pattern is identical every time.

Thank you for your assistance with this matter.

Solved

1 Replies

2 months ago

Hmm,
We have a slight bug we're working on with the whole "push code" -> "get it live" flow of metal builders. If it gets stuck, can you try switching off metal builders and see if it works?


Status changed to Awaiting User Response Railway about 2 months ago


Railway
BOT

2 months 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 about 2 months ago


Loading...