Sitelet https://github.com/nodejs/node/issues/46110
Skip to content

inspector.url()/open() does not work if NODE_V8_COVERAGE is set #46110

Description

@connor4312

Version

v19.3.0

Platform

Darwin MacBook-Pro-2.guest.corp.microsoft.com 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:08:47 PST 2022; root:xnu-8792.61.2~4/RELEASE_X86_64 x86_64

Subsystem

inspector

What steps will reproduce the bug?

$ NODE_V8_COVERAGE=/tmp node -p "inspector.url()"
undefined
$ NODE_V8_COVERAGE=/tmp node -p "inspector.open()"
node:inspector:172
    throw new ERR_INSPECTOR_ALREADY_ACTIVATED();

How often does it reproduce? Is there a required condition?

100%

What is the expected behavior?

I would expect, regardless of whether NODE_V8_COVERAGE is set, to be able to inspector.open() if there is no inspector.url(), and then after calling that be able to access inspector.url()

What do you see instead?

If NODE_V8_COVERAGE is set, inspector.url() is undefined but inspector.open() throws an error.

Additional information

Originally reported on microsoft/vscode-js-debug#1507

It looks like new inspector.Session().connect() does still work in case, so we could 'fake' the inspect server as a workaround, but this is a complex hack.

Activity

  1. changed the title [-]Node.js cannot be inspected if NODE_V8_COVERAGE is set[/-] [+]inspector.url()/open() does not work if NODE_V8_COVERAGE is set[/+] on Jan 5, 2023
  2. added
    inspectorIssues and PRs related to the V8 inspector protocol.
    coverageIssues and PRs related to Node.js code coverage support.
    on Jan 5, 2023
  3. MoLow commented on Jan 5, 2023

    @MoLow
    Member

    a workaround (until it is fixed) is adding --inspect :
    NODE_V8_COVERAGE=/tmp node --inspect -p "inspector.url()"

  4. connor4312 commented on Jan 5, 2023

    @connor4312
    ContributorAuthor

    Unfortunately in my case, the subprocess with NODE_V8_COVERAGE is spawned by c8, which the VS Code Debugger does not control.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    coverageIssues and PRs related to Node.js code coverage support.inspectorIssues and PRs related to the V8 inspector protocol.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions