Skip to content

fix(indexer): resolve compilation and migration issues in local deployment#3345

Open
yasyzb wants to merge 1 commit into
dydxprotocol:mainfrom
yasyzb:fix/local-indexer-build-issues
Open

fix(indexer): resolve compilation and migration issues in local deployment#3345
yasyzb wants to merge 1 commit into
dydxprotocol:mainfrom
yasyzb:fix/local-indexer-build-issues

Conversation

@yasyzb

@yasyzb yasyzb commented Jun 6, 2026

Copy link
Copy Markdown

Description

This Pull Request resolves two universal issues encountered when compiling and setting up the local Indexer environment.

1. Enable skipLibCheck in tsconfig compiler options

  • Problem: During TypeScript compilation, type conflicts inside third-party dependency declaration files (.d.ts) often cause the build to fail.
  • Solution: Added "skipLibCheck": true under "compilerOptions" in indexer/tsconfig.json. This instructs the TypeScript compiler to skip type checking of declaration files (.d.ts) from third-party libraries, which is standard practice to avoid dependency-level type mismatches.

2. Remove --production flag from pnpm install in Dockerfile.postgres-package.local

  • Problem: In indexer/Dockerfile.postgres-package.local, NODE_ENV is set to development, yet pnpm install is executed with the --production flag. This prevents devDependencies (such as typescript and ts-node) from being installed. Consequently, the container fails to execute database migrations because ts-node cannot be found.
  • Solution: Removed the --production flag from the local deployment Dockerfile to ensure that devDependencies required for local migration runs are properly installed.

Test Plan

  • Build and run local indexer: docker compose -f indexer/docker-compose-local-deployment.yml up --build
  • Verify that postgres-package-1 builds successfully, compiles typescript schemas, and exits with code 0 after successfully completing migrations.

Summary by CodeRabbit

  • Chores
    • Build configuration updated so images are produced with the full set of project dependencies.
  • Performance
    • Type-checking of external declaration files is skipped to reduce compilation time and speed up local and CI builds.

@yasyzb yasyzb requested a review from a team as a code owner June 6, 2026 02:32
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Need an answer fast? Review this PR in Change Stack to ask focused questions about the PR or a changed range.

Review Change Stack

📝 Walkthrough

Walkthrough

Updates indexer build and compile settings: the Docker image build now runs pnpm i (installing all dependencies), and indexer/tsconfig.json enables compilerOptions.skipLibCheck.

Changes

Indexer Build Configuration

Layer / File(s) Summary
Docker image dependencies
indexer/Dockerfile.postgres-package.local
The pnpm install command during Docker image build is changed from pnpm i --production to pnpm i, installing all dependencies including development packages.
TypeScript compilation options
indexer/tsconfig.json
The skipLibCheck compiler option is added to TypeScript configuration, disabling type checking of declaration files during compilation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • tqin7

Poem

🐰 In builds I hop, dependencies now whole,
Types take a nap, declarations unrolled,
A tiny tweak made, quiet and neat,
Images lighter, compiles more fleet,
Hooray for small changes — a rabbit's small feat!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: resolving compilation and migration issues in local deployment by enabling skipLibCheck and removing the --production flag.
Description check ✅ Passed The description includes a detailed Changelist with clear explanations of both issues and solutions, and a comprehensive Test Plan. However, the Author/Reviewer Checklist is missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
indexer/tsconfig.json (1)

16-16: ⚡ Quick win

Consider documenting the specific type conflict and treating this as a temporary workaround.

While skipLibCheck: true is effective for unblocking builds when third-party declaration files conflict, it masks underlying type issues rather than resolving them. Consider:

  1. Adding a comment in this file documenting which specific dependency or type conflict necessitated this flag
  2. Creating a follow-up task to investigate and resolve the root cause
  3. Monitoring whether future dependency updates resolve the conflict naturally

This approach helps future maintainers understand the reasoning and provides a path toward removing the workaround.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@indexer/tsconfig.json` at line 16, Add a short comment near the
"skipLibCheck": true setting in tsconfig.json documenting the exact type
conflict or dependency that required this workaround (e.g., which package or
declaration file caused the error), add a TODO or follow-up task reference
(issue/PR or tracker ID) to investigate and fix the root cause, and include
guidance to revisit/remove this flag once that investigation or dependency
updates resolve the conflict; keep the comment concise and actionable so future
maintainers can find and address the underlying type issue.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@indexer/tsconfig.json`:
- Line 16: Add a short comment near the "skipLibCheck": true setting in
tsconfig.json documenting the exact type conflict or dependency that required
this workaround (e.g., which package or declaration file caused the error), add
a TODO or follow-up task reference (issue/PR or tracker ID) to investigate and
fix the root cause, and include guidance to revisit/remove this flag once that
investigation or dependency updates resolve the conflict; keep the comment
concise and actionable so future maintainers can find and address the underlying
type issue.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 71be8257-83c4-4454-87cf-3fd50af440b3

📥 Commits

Reviewing files that changed from the base of the PR and between 5ee9766 and 5e58e2a.

📒 Files selected for processing (2)
  • indexer/Dockerfile.postgres-package.local
  • indexer/tsconfig.json

@yasyzb yasyzb force-pushed the fix/local-indexer-build-issues branch from 5e58e2a to 7df72e1 Compare June 6, 2026 10:15

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
indexer/Dockerfile.postgres-package.local (1)

43-43: Migrations require devDependencies (ts-node + .ts files), so removing --production is correct.

  • indexer/packages/postgres/knexfile.js loads ts-node/register
  • Migrations in indexer/packages/postgres/src/db/migrations/migration_files/ are all TypeScript (*.ts)
  • indexer/packages/postgres/package.json runs knex migrate:latest, and devDependencies include ts-node/typescript

So RUN pnpm i --loglevel warn --frozen-lockfile --unsafe-perm (instead of using --production) matches what’s needed for the migration container. Consider adding a short Dockerfile comment explaining why devDependencies must be installed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@indexer/Dockerfile.postgres-package.local` at line 43, Keep the current
installation line using devDependencies (RUN pnpm i --loglevel warn
--frozen-lockfile --unsafe-perm) and add a short Dockerfile comment above it
explaining that devDependencies (ts-node/typescript) are required for running
Knex migrations because indexer/packages/postgres/knexfile.js loads
ts-node/register and migrations in
indexer/packages/postgres/src/db/migrations/migration_files/ are TypeScript
(*.ts); reference that the package.json runs "knex migrate:latest" so the
container must install devDependencies rather than using --production.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@indexer/Dockerfile.postgres-package.local`:
- Line 43: Keep the current installation line using devDependencies (RUN pnpm i
--loglevel warn --frozen-lockfile --unsafe-perm) and add a short Dockerfile
comment above it explaining that devDependencies (ts-node/typescript) are
required for running Knex migrations because
indexer/packages/postgres/knexfile.js loads ts-node/register and migrations in
indexer/packages/postgres/src/db/migrations/migration_files/ are TypeScript
(*.ts); reference that the package.json runs "knex migrate:latest" so the
container must install devDependencies rather than using --production.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7ad61f6e-e930-4528-9b0e-7b21ada359e8

📥 Commits

Reviewing files that changed from the base of the PR and between 5e58e2a and 7df72e1.

📒 Files selected for processing (2)
  • indexer/Dockerfile.postgres-package.local
  • indexer/tsconfig.json
✅ Files skipped from review due to trivial changes (1)
  • indexer/tsconfig.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant