Unitech / Unitech/pm2

[Bug]: How do I disable @pm2/io when I use pm2, I hope it doesn't autoload

Open
#5,844 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

Version

v22.3.0

Platform

Darwin mac-studio.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?
  • Create a new file pm2.io.js, install @pm2/io deps
const io = require('@pm2/io'); // @pm2/io version is 6.0.0
io.init({});
  • Executing the script
pm2 start pm2.io.js --node-args="--experimental-permission --allow-fs-read=*" -f
  • View pm2 logs, use pm2 logs command
0|pm2.io | node:inspector:59
0|pm2.io |     this.#connection = new Connection((message) => this.#onMessage(message));
0|pm2.io |                        ^
0|pm2.io | Error: Access to this API has been restricted
0|pm2.io |     at Session.connect (node:inspector:59:24)
0|pm2.io |     at InspectorService.init (/Users/skypesky/Library/pnpm/global/5/.pnpm/@pm2+io@6.0.0/node_modules/@pm2/io/build/main/services/inspector.js:14:22)
0|pm2.io |     at PMX.init (/Users/skypesky/Library/pnpm/global/5/.pnpm/@pm2+io@6.0.0/node_modules/@pm2/io/build/main/pmx.js:72:30)
0|pm2.io |     at Object.<anonymous> (/Users/skypesky/Library/pnpm/global/5/.pnpm/@pm2+io@6.0.0/node_modules/@pm2/io/build/main/index.js:5:65)
0|pm2.io |     at Module._compile (node:internal/modules/cjs/loader:1460:14)
0|pm2.io |     at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
0|pm2.io |     at Module.load (node:internal/modules/cjs/loader:1275:32)
0|pm2.io |     at Module._load (node:internal/modules/cjs/loader:1091:12)
0|pm2.io |     at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
0|pm2.io |     at Module.require (node:internal/modules/cjs/loader:1297:12) {
0|pm2.io |   code: 'ERR_ACCESS_DENIED',
0|pm2.io |   permission: 'Inspector',
0|pm2.io |   resource: 'Connect'
0|pm2.io | }
0|pm2.io | Node.js v22.3.0
How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

It should start and run normally without throwing any errors

What do you see instead?
0|pm2.io | node:inspector:59
0|pm2.io |     this.#connection = new Connection((message) => this.#onMessage(message));
0|pm2.io |                        ^
0|pm2.io | Error: Access to this API has been restricted
0|pm2.io |     at Session.connect (node:inspector:59:24)
0|pm2.io |     at InspectorService.init (/Users/skypesky/Library/pnpm/global/5/.pnpm/@pm2+io@6.0.0/node_modules/@pm2/io/build/main/services/inspector.js:14:22)
0|pm2.io |     at PMX.init (/Users/skypesky/Library/pnpm/global/5/.pnpm/@pm2+io@6.0.0/node_modules/@pm2/io/build/main/pmx.js:72:30)
0|pm2.io |     at Object.<anonymous> (/Users/skypesky/Library/pnpm/global/5/.pnpm/@pm2+io@6.0.0/node_modules/@pm2/io/build/main/index.js:5:65)
0|pm2.io |     at Module._compile (node:internal/modules/cjs/loader:1460:14)
0|pm2.io |     at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
0|pm2.io |     at Module.load (node:internal/modules/cjs/loader:1275:32)
0|pm2.io |     at Module._load (node:internal/modules/cjs/loader:1091:12)
0|pm2.io |     at wrapModuleLoad (node:internal/modules/cjs/loader:212:19)
0|pm2.io |     at Module.require (node:internal/modules/cjs/loader:1297:12) {
0|pm2.io |   code: 'ERR_ACCESS_DENIED',
0|pm2.io |   permission: 'Inspector',
0|pm2.io |   resource: 'Connect'
0|pm2.io | }
0|pm2.io | Node.js v22.3.0
Additional information

related: https://github.com/nodejs/node/issues/53447#issuecomment-2167122228

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with pm2.io.js and the pm2 start command using Node.js permission flags. Start from the @pm2/io InspectorService.init stack trace and determine how PM2 and @pm2/io handle this restricted API; done means the requested disable behavior is implemented or clearly exposed and the process runs without the Inspector error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.