Skip to content

fix(seed): put node_modules/.bin on PATH so prisma db seed finds ts-node - #1822

Merged
ajile-in merged 3 commits into
mainfrom
fix/seed-image-path
Nov 4, 2026
Merged

ajile-in merged 3 commits into
mainfrom
fix/seed-image-path

Conversation

@ajile-in

@ajile-in ajile-in commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Problem

The seed image fails on a fresh install:

```
Running seed command `ts-node prisma/seed.ts` ...
Error: Command failed with ENOENT: ts-node prisma/seed.ts
spawn ts-node ENOENT
```

#1775 replaced `npx prisma` with `/app/node_modules/.bin/prisma` in `Dockerfile.seed`. Calling the binary by path does not add `node_modules/.bin` to `PATH` (npx did), so `prisma db seed` cannot spawn `ts-node` by name. The compose `seed` container exits with an error and the master data is not loaded.

Fix

`ENV PATH=/app/node_modules/.bin:$PATH` in the final stage. The explicit `/app/node_modules/.bin/prisma` calls stay as they are, so the hardening from #1775 is unchanged (no npx).

How it was found / verified

Smoke test of the `v2.3.0-rc.3` images against a fresh Postgres 16:

  • all migrations applied, including `add_cryptographic_binding_methods_to_oidc_issuer`
  • the seed then failed with the error above
  • re-running the same rc.3 image with `node_modules/.bin` on `PATH` made the seed run and load data (ledgers and a user were present); it then stopped at the Keycloak client-credentials step, which is expected without a Keycloak in that setup

Not verified: a rebuild of the seed image with this change (the build could not run, the disk was full). The Dockerfile change is one `ENV` line; CI or a local `docker build` will confirm.

Affects `v2.3.0`: needs to be cherry-picked to `release/v2.3`.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability of database setup by ensuring the seeding step can locate the tools it needs. This helps deployments complete initialization successfully and reduces the chance of setup failures when preparing application data.

Since #1775 the seed image calls the prisma binary by path instead of npx, which no longer adds node_modules/.bin to PATH. prisma db seed then fails with 'spawn ts-node ENOENT' and the compose seed container exits with an error on a fresh install. Found by running the v2.3.0-rc.3 seed image against a fresh Postgres: migrations applied, then the seed failed; with node_modules/.bin on PATH the seed runs.

Signed-off-by: Ajay Jadhav <ajay@ayanworks.com>
@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The seed Docker image prepends /app/node_modules/.bin to PATH. This allows the seed process to look up installed executables, including ts-node, by name.

Changes: Seed container setup

Layer / File(s) Summary
Add local executables to PATH
Dockerfiles/Dockerfile.seed
The seed image prepends /app/node_modules/.bin to the existing PATH. A comment documents executable lookup.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Possibly related PRs

  • credebl/platform#1775: This PR changed the seed Dockerfile and removed node_modules/.bin from PATH; this change restores the directory to PATH.

Suggested reviewers: ankita-p17

Merge Risk: Minimal · previous review d7e6f

The change is limited to exposing installed seed executables; perform normal image-build validation before release.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding node_modules/.bin to PATH so Prisma seed can find ts-node.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

Finishing Touches
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9dcb146b-2d42-47d9-bc9f-2c4be6965d4a
Commits

Reviewing files that changed from the base of the PR and between ad78033 and d7e6ff7.

Files selected for processing: 1
  • Dockerfiles/Dockerfile.seed

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Signed-off-by: Ajay Jadhav <ajay@ayanworks.com>
This reverts commit 9bb49b4.

Signed-off-by: Ajay Jadhav <ajay@ayanworks.com>
@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@ajile-in ajile-in self-assigned this Nov 4, 2026
@ajile-in
ajile-in merged commit 5e1a367 into main Nov 4, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants