Skip to content

feat(ccip-server): migrate to Prisma 7 and ncc bundling#7895

Merged
paulbalaji merged 3 commits intomainfrom
feat/ccip-server-prisma7-ncc
Jan 28, 2026
Merged

feat(ccip-server): migrate to Prisma 7 and ncc bundling#7895
paulbalaji merged 3 commits intomainfrom
feat/ccip-server-prisma7-ncc

Conversation

@paulbalaji
Copy link
Collaborator

@paulbalaji paulbalaji commented Jan 26, 2026

Summary

  • Migrate ccip-server from pnpm deploy to ncc bundling
  • Upgrade Prisma 6 → Prisma 7 (TypeScript query compiler, no Rust binaries)
  • Unify ccip-server into shared Dockerfile.node-service
  • Achieves ~80% image size reduction

Why Prisma 7?

PR #7565 noted: "Once we upgrade to Node 24, we can upgrade to Prisma 7 which supports ncc bundling."

Prisma 7 eliminates the Rust query engine binary in favor of a TypeScript/WASM implementation, making it compatible with ncc bundling.

References:

Key migration changes:

  • Generator provider: prisma-client-jsprisma-client
  • Driver adapter required: @prisma/adapter-pg for PostgreSQL
  • Datasource URL moved from schema.prisma to prisma/config.ts

Image Size Comparison

Image Size Reduction
ccip-server (pnpm deploy, Prisma 6) 1.64 GB -
ccip-server (ncc bundle, Prisma 7) ~300 MB ~82%

Dockerfile Unification

This PR also unifies ccip-server into the shared Dockerfile.node-service:

  • Adds conditional Prisma schema copy (BuildKit bind mount)
  • Adds optional SERVICE_PORT arg for HTTP services
  • Adds ccip-server to ncc-services matrix in docker-bake.hcl
  • Deletes separate typescript/ccip-server/Dockerfile

Changes

  • typescript/ccip-server/prisma/schema.prisma - Prisma 7 generator
  • typescript/ccip-server/prisma/config.ts - Prisma 7 datasource config
  • typescript/ccip-server/package.json - Prisma 7 deps + bundle script
  • typescript/ccip-server/src/db.ts - Prisma 7 adapter pattern
  • typescript/ccip-server/scripts/ncc.post-bundle.mjs - Bundle patching
  • typescript/Dockerfile.node-service - Prisma support + SERVICE_PORT
  • typescript/docker-bake.hcl - Add ccip-server to matrix

Deleted Files

  • typescript/ccip-server/Dockerfile

Stacked on #7881

Test Plan

  • pnpm install succeeds with Prisma 7
  • prisma generate succeeds
  • pnpm turbo run bundle --filter=@hyperlane-xyz/ccip-server succeeds
  • Lint passes
  • Docker build succeeds in CI

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Upgraded database dependencies to Prisma v7 with native PostgreSQL adapter integration
    • Added application bundling capability for optimized production deployments
    • Enabled dynamic service port configuration in containerized environments with default port 3000
    • Restructured Docker build infrastructure for improved scalability and efficiency

✏️ Tip: You can customize this high-level summary in your review settings.

@socket-security
Copy link

socket-security bot commented Jan 26, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​types/​pg@​8.16.01001007388100
Updatednpm/​prisma@​6.19.0 ⏵ 7.3.075 -191009798100
Addednpm/​@​prisma/​adapter-pg@​7.3.01001008398100
Updatednpm/​@​prisma/​client@​6.19.0 ⏵ 7.3.099 +51008598100
Addednpm/​pg@​8.17.2981009993100

View full report

@hyperlane-xyz hyperlane-xyz deleted a comment from mergify bot Jan 26, 2026
@paulbalaji paulbalaji force-pushed the feat/ccip-server-prisma7-ncc branch 5 times, most recently from ce8f2a3 to ae751ae Compare January 26, 2026 15:00
Base automatically changed from chore/node-24-migration to main January 27, 2026 14:28
@paulbalaji paulbalaji force-pushed the feat/ccip-server-prisma7-ncc branch from ae751ae to a1ec4a0 Compare January 27, 2026 14:43
@paulbalaji paulbalaji marked this pull request as ready for review January 27, 2026 14:43
@paulbalaji paulbalaji marked this pull request as draft January 27, 2026 14:45
@hyper-gonk
Copy link
Contributor

hyper-gonk bot commented Jan 27, 2026

🔍 CCIP Server Docker Image Built Successfully

Image Tags:

gcr.io/abacus-labs-dev/hyperlane-offchain-lookup-server:pr-7895
gcr.io/abacus-labs-dev/hyperlane-offchain-lookup-server:a1ec4a0-20260127-144347

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2026

Warning

Rate limit exceeded

@paulbalaji has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 12 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📝 Walkthrough

Walkthrough

This PR removes the standalone CCIP server Dockerfile, upgrades Prisma to version 7 with PostgreSQL adapter support, introduces bundling via ncc, and consolidates the service into the shared node-service Docker infrastructure with configurable port support.

Changes

Cohort / File(s) Summary
Build & Bundling Configuration
typescript/ccip-server/package.json, typescript/ccip-server/turbo.json
Added bundle script using ncc with output to bundle/ directory and exclusion of Google Cloud logging; replaced build task with new bundle task that depends on build; added dev dependency @vercel/ncc and dev dependency @types/pg
Prisma v7 Migration
typescript/ccip-server/prisma/schema.prisma, typescript/ccip-server/prisma/config.ts, typescript/ccip-server/src/db.ts
Updated generator provider from "prisma-client-js" to "prisma-client"; moved DATABASE_URL configuration to new prisma/config.ts file using defineConfig; instantiated PrismaPg adapter with PostgreSQL pool in db.ts; added runtime dependency @prisma/adapter-pg and bumped @prisma/client to ^7.3.0
Ignore & Lint Configuration
typescript/ccip-server/.gitignore, typescript/ccip-server/eslint.config.mjs
Added /bundle directory to gitignore; added bundle/** and prisma/config.ts to ESLint ignore list
Docker & Infrastructure
typescript/Dockerfile.node-service, typescript/docker-bake.hcl
Removed standalone ccip-server Dockerfile entirely; added optional SERVICE_PORT build arg and conditional prisma schema copying in node-service builder stage; integrated ccip-server into ncc-services matrix with port 3000; added dynamic port exposure via ${SERVICE_PORT:-9090}

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Suggested reviewers

  • antigremlin
  • nambrot
  • ltyu
  • Xaroz
  • xeno097
  • Mo-Hussain

Poem

🏰 Like a swamp with many layers, this one does,
Removed a Dockerfile, no fuss or much fuss,
Prisma seven adapts to the pool's embrace,
Bundled and tucked in its designated place,
One Docker to serve 'em, one port to configure—
The structure simplifies, wouldn't you concur? 🔗

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: migrating ccip-server to Prisma 7 and implementing ncc bundling, which directly reflects the core objectives of the PR.
Description check ✅ Passed The description comprehensively covers all required template sections with detailed context, rationale, changes list, test plan, and image size comparisons, demonstrating thorough documentation of the migration work.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/ccip-server-prisma7-ncc

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@typescript/ccip-server/Dockerfile`:
- Around line 99-100: The RUN step installing
`@google-cloud/pino-logging-gcp-config` should pin a specific version to ensure
reproducible builds; update the Dockerfile's RUN npm install line that
references `@google-cloud/pino-logging-gcp-config` to include an explicit version
(matching your project's pinned toolset policy) rather than installing the
latest.
🧹 Nitpick comments (4)
typescript/ccip-server/package.json (1)

70-70: Consider moving prisma CLI to devDependencies.

The prisma package is primarily the CLI tool used for migrations and generation during development/CI. Having it in dependencies means it'll be included in production deployments unnecessarily. The @prisma/client belongs in dependencies (which you have), but the CLI itself is usually a dev-time thing.

Since postinstall runs prisma generate and you're bundling for production, this shouldn't affect your workflow - the generation happens before bundling anyway.

🧅 Suggested change
   "dependencies": {
     ...
-    "prisma": "^7.3.0",
     ...
   },
   "devDependencies": {
     ...
+    "prisma": "^7.3.0",
     ...
   }
typescript/ccip-server/scripts/ncc.post-bundle.mjs (1)

36-45: These patches are a bit brittle but necessary for the WASM/Worker compatibility.

The regex and string replacements are tightly coupled to ncc's current output format. If ncc or Prisma's bundled output changes shape, these could silently fail to match. Might be worth adding a warning if no replacements were made, so you know when Prisma or ncc updates break things.

🔧 Optional: Add match verification
+    let wasmPatchCount = 0;
     // Patch WASM init to use file:// URLs
     content = content.replace(
       /await __wbg_init\(\{ module_or_path: (module\$\d+) \}\)/g,
-      'await __wbg_init({ module_or_path: pathToFileURL($1).href })',
+      (match, p1) => {
+        wasmPatchCount++;
+        return `await __wbg_init({ module_or_path: pathToFileURL(${p1}).href })`;
+      },
     );

+    const workerPatchApplied = content.includes('const worker = new Worker(url,');
     // Patch Worker creation to accept file:// URLs
     content = content.replace(
       'const worker = new Worker(url,',
       'const worker = new Worker(pathToFileURL(url),',
     );

+    if (wasmPatchCount === 0) {
+      console.warn('⚠ No WASM init patterns found - ncc output may have changed');
+    }
+    if (!workerPatchApplied) {
+      console.warn('⚠ Worker pattern not found - ncc output may have changed');
+    }
typescript/ccip-server/src/db.ts (2)

6-8: Consider validating DATABASE_URL before creating the pool.

Right now, if DATABASE_URL is missing from the environment, this'll fail somewhere down the road when you actually try to query - probably with a confusing error message. It's like wandering into a swamp without checking if there's actually water in it.

A quick check upfront would make debugging easier when things go sideways:

♻️ Suggested improvement
+const connectionString = process.env.DATABASE_URL;
+if (!connectionString) {
+  throw new Error('DATABASE_URL environment variable is required');
+}
+
-const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
+const pool = new pg.Pool({ connectionString });
 const adapter = new PrismaPg(pool);
 export const prisma = new PrismaClient({ adapter });

6-6: Pool configuration is using defaults - verify this meets production needs.

The pg.Pool is created with just the connection string, which means you're getting the library defaults (max 10 connections, no idle timeout, etc.). This might be perfectly fine for your use case, but worth confirming it matches what's needed in production. Not everyone's swamp has the same traffic patterns.

@paulbalaji paulbalaji force-pushed the feat/ccip-server-prisma7-ncc branch from a1ec4a0 to 9b9993b Compare January 27, 2026 14:49
@paulbalaji paulbalaji changed the base branch from main to pbio/unified-docker-workflows January 27, 2026 14:50
@paulbalaji paulbalaji force-pushed the feat/ccip-server-prisma7-ncc branch from 9b9993b to 102162d Compare January 27, 2026 15:01
@paulbalaji paulbalaji force-pushed the pbio/unified-docker-workflows branch from 0815fbe to edefef1 Compare January 27, 2026 15:02
@paulbalaji paulbalaji force-pushed the feat/ccip-server-prisma7-ncc branch from 102162d to 144a6e5 Compare January 27, 2026 15:07
@paulbalaji paulbalaji force-pushed the pbio/unified-docker-workflows branch from 9a57586 to edefef1 Compare January 27, 2026 15:09
@paulbalaji paulbalaji force-pushed the feat/ccip-server-prisma7-ncc branch from 144a6e5 to dea4518 Compare January 27, 2026 15:09
@paulbalaji paulbalaji marked this pull request as ready for review January 27, 2026 15:23
@paulbalaji paulbalaji force-pushed the feat/ccip-server-prisma7-ncc branch from dea4518 to 562969c Compare January 27, 2026 16:21
@Mo-Hussain
Copy link
Collaborator

Can we deploy the testnet offchain lookup server of this branch and do some test transfers on USDC /testnet-cctp

Base automatically changed from pbio/unified-docker-workflows to main January 28, 2026 15:01
@paulbalaji paulbalaji requested review from Xaroz and ltyu as code owners January 28, 2026 15:01
@paulbalaji paulbalaji force-pushed the feat/ccip-server-prisma7-ncc branch from 9287aa5 to 08de4f7 Compare January 28, 2026 15:05
@paulbalaji paulbalaji enabled auto-merge January 28, 2026 15:05
@paulbalaji paulbalaji added this pull request to the merge queue Jan 28, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@typescript/Dockerfile.node-service`:
- Around line 134-135: The Dockerfile currently uses shell-style parameter
expansion in an EXPOSE line (EXPOSE ${SERVICE_PORT:-9090}), which Dockerfile
EXPOSE doesn't support; replace that line by either removing the
shell-substitution and relying on the unconditional EXPOSE 9090 (delete EXPOSE
${SERVICE_PORT:-9090}), or switch to a build ARG pattern (declare ARG
SERVICE_PORT with a default and then use EXPOSE ${SERVICE_PORT}) so Docker
interprets it correctly; alternatively document that services like rebalancer
and warp-monitor must publish ports at runtime with -p (or add explicit EXPOSE
entries per service such as EXPOSE 3000 for ccip-server) and ensure only valid
literal port numbers appear in EXPOSE lines.
🧹 Nitpick comments (1)
typescript/ccip-server/src/db.ts (1)

6-8: Consider adding some pool configuration to keep things from gettin' too crowded.

The pool is created with just connectionString, which means it'll use pg's defaults (typically 10 max connections). For a production service, ya might want to explicitly set pool options to avoid surprisin' behavior under load.

♻️ Optional: Add pool configuration
-const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
+const pool = new pg.Pool({
+  connectionString: process.env.DATABASE_URL,
+  max: 20,              // Maximum pool size
+  idleTimeoutMillis: 30000,
+  connectionTimeoutMillis: 5000,
+});

Also worth notin' — if DATABASE_URL is undefined, pg.Pool will still try to connect using defaults (localhost:5432). If you'd rather fail fast in that case:

if (!process.env.DATABASE_URL) {
  throw new Error('DATABASE_URL environment variable is required');
}

@paulbalaji paulbalaji removed this pull request from the merge queue due to a manual request Jan 28, 2026
@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.02%. Comparing base (f5eef17) to head (cb5e02b).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7895   +/-   ##
=======================================
  Coverage   77.02%   77.02%           
=======================================
  Files         117      117           
  Lines        2651     2651           
  Branches      244      244           
=======================================
  Hits         2042     2042           
  Misses        593      593           
  Partials       16       16           
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 71.86% <ø> (ø)
isms 81.10% <ø> (ø)
token 86.67% <ø> (ø)
middlewares 84.98% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@paulbalaji paulbalaji enabled auto-merge January 28, 2026 15:18
@hyper-gonk
Copy link
Contributor

hyper-gonk bot commented Jan 28, 2026

⚙️ Node Service Docker Images Built Successfully

Service Tag
🔍 offchain-lookup-server cb5e02b-20260128-151824
♻️ rebalancer cb5e02b-20260128-151824
🕵️ warp-monitor cb5e02b-20260128-151824
Full image paths
gcr.io/abacus-labs-dev/hyperlane-offchain-lookup-server:cb5e02b-20260128-151824
gcr.io/abacus-labs-dev/hyperlane-rebalancer:cb5e02b-20260128-151824
gcr.io/abacus-labs-dev/hyperlane-warp-monitor:cb5e02b-20260128-151824

@hyper-gonk
Copy link
Contributor

hyper-gonk bot commented Jan 28, 2026

🐳 Monorepo Docker Image Built Successfully

Service Tag
📦 monorepo cb5e02b-20260128-152004
Full image paths
gcr.io/abacus-labs-dev/hyperlane-monorepo:cb5e02b-20260128-152004

@paulbalaji paulbalaji added this pull request to the merge queue Jan 28, 2026
Merged via the queue into main with commit add6ee2 Jan 28, 2026
115 checks passed
@paulbalaji paulbalaji deleted the feat/ccip-server-prisma7-ncc branch January 28, 2026 15:41
@github-project-automation github-project-automation bot moved this from In Review to Done in Hyperlane Tasks Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants