Skip to content

PM2/Production Deployment Failure #38

@arun-8687

Description

@arun-8687

Title: isMain check fails under PM2 preventing startup

Description: When deploying compiled code (dist/index.js) using PM2, the application starts but does nothing. This is because PM2 wraps the execution, causing process.argv[1] to point to PM2's internal wrapper instead of the script file.

Location:
src/index.ts

Fix: Use a more robust check that allows for PM2's environment or filename matching.

const isMain =
  executedFile === currentFile ||
  (executedFile && currentFile && path.basename(executedFile) === path.basename(currentFile)) ||
  !!process.env.pm_id;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions