Skip to content

Testing pm2 vs deno in cluster does not work #6042

@lockphase

Description

@lockphase

Testing deno with load balancing, I setup an ec2 instance with node, pm2 and deno installed. Pm2 fails using below config.

module.exports = {
  apps : [{
    name: 'app',
    script: '/home/ec2-user/test/app.ts',
    interpreter: "deno",
    interpreter_args: "run --allow-env --allow-net --allow-read --allow-sys",
    instances: "max",
    exec_mode: "cluster",
	  increment_var : 'PORT',
    env: {
      "PORT": 8000,
      "NODE_ENV": "development",
    },
  }]
};

From logs:

Error: Cannot find module '/home/ec2-user/test/run'
    at Function._resolveFilename (node:internal/modules/cjs/loader:1383:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
    at Function._load (node:internal/modules/cjs/loader:1192:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
    at node:internal/main/run_main_module:36:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

For some reason, the interpreter option is ignored in the config file as pm2 keeps trying to exec run using node. I have tried using absolute path in the interpreter as well to no avail. Running from CLI on a single cpu works pm2 start app.ts --interpreter="deno" --interpreter-args="run --allow-env --allow-net" . Running from CLI with added -i max also fails.

Is this wai? or am I missing smthg? Seems like clusters do not work with deno...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions