Skip to content

fix: move ts-node from devDependencies to dependencies for migration support#5273

Merged
devin-ai-integration[bot] merged 3 commits intomainfrom
devin/1769445481-fix-ts-node-migration
Jan 26, 2026
Merged

fix: move ts-node from devDependencies to dependencies for migration support#5273
devin-ai-integration[bot] merged 3 commits intomainfrom
devin/1769445481-fix-ts-node-migration

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jan 26, 2026

Context

Fixes #5261

The standalone Docker image (Dockerfile.standalone-infisical) uses npm ci --omit=dev to install only production dependencies. However, the migration scripts (knexfile.ts and auditlog-knexfile.ts) import ts-node/register, which requires ts-node to be available at runtime.

Since ts-node was in devDependencies, it wasn't being installed in the production image, causing migration jobs to fail with a module not found error.

This PR moves both ts-node and tsconfig-paths from devDependencies to dependencies so they're available in the production Docker image. The tsconfig-paths package is also required because the tsconfig.json configures ts-node to use it via "require": ["tsconfig-paths/register"].

Steps to verify the change

  1. Build the standalone Docker image: docker build -f Dockerfile.standalone-infisical -t infisical-test .
  2. Verify ts-node loads correctly: docker run --rm infisical-test node -e "require('ts-node/register'); console.log('success')"
  3. Run the container and verify migrations execute successfully

Type

  • Fix
  • Feature
  • Improvement
  • Breaking
  • Docs
  • Chore

Checklist

Human Review Checklist

  • Verify migration scripts run correctly in the production Docker image
  • Note: Snyk flagged a medium severity vulnerability in ts-node dependencies - this is pre-existing since ts-node was already in the codebase (just in devDependencies)

Link to Devin run: https://app.devin.ai/sessions/5a94da773e0d4103b807ec6a0df65455
Requested by: akhilmhdh@infisical.com

…support

Co-Authored-By: akhilmhdh@infisical.com <akhilmhdh@infisical.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@maidul98
Copy link
Collaborator

maidul98 commented Jan 26, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 26, 2026

Greptile Overview

Greptile Summary

This PR moves ts-node from devDependencies to dependencies to fix migration failures in the standalone Docker image. The knexfile configuration files (backend/src/db/knexfile.ts and backend/src/db/auditlog-knexfile.ts) both import ts-node/register at the top, and when compiled to .mjs files, this import statement remains in the output. Since the Dockerfile uses npm ci --omit=dev (line 114), devDependencies aren't installed in production, causing the migration scripts to fail with a module not found error.

Key Changes:

  • Moved ts-node (^10.9.2) from devDependencies to dependencies in package.json
  • Updated package-lock.json to reflect ts-node and its transitive dependencies (@cspotcode/source-map-support, @jridgewell/*, @tsconfig/*, acorn-walk, arg) as production dependencies

Impact:

  • Fixes migration execution in standalone Docker deployments
  • Adds ~2-3MB to production image size (ts-node and dependencies)
  • No breaking changes or security concerns

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a straightforward dependency move that directly addresses a production bug. Moving ts-node from devDependencies to dependencies is a valid fix for the migration failure issue. While there's a more optimal solution (removing the ts-node import from the source files), this approach works correctly and has no security implications. The change only affects the Docker standalone build process and doesn't introduce any breaking API changes or security vulnerabilities.
  • No files require special attention

Important Files Changed

Filename Overview
backend/package.json Moves ts-node from devDependencies to dependencies to fix production migration failures
backend/package-lock.json Updates lockfile to reflect ts-node and its transitive dependencies as production dependencies

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Co-Authored-By: akhilmhdh@infisical.com <akhilmhdh@infisical.com>
akhilmhdh
akhilmhdh previously approved these changes Jan 26, 2026
@devin-ai-integration devin-ai-integration bot merged commit 18485f6 into main Jan 26, 2026
10 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.

Error with ts-node in migration job

2 participants