GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — console.log(proxy) default output is less than helpful · Issue #60964 · nodejs/node

console.log(proxy) default output is less than helpful #60964

New issue
Copy link
New issue
Copy link
Closed
#61029
Closed
console.log(proxy) default output is less than helpful#60964
#61029
Copy link
Labels
feature requestIssues requesting new Node.js features.utilIssues and PRs related to the built-in util module.

Description

@jasnell
jasnell
opened on Dec 5, 2025
Issue body actions

Version

All

Platform

All

Subsystem

console/util.inspect

What steps will reproduce the bug?

const p = new Proxy({}, {
  ownKeys() { return ['a']; },
  getOwnPropertyDescriptor() {
    return { value: 1, writable: false, enumerable: true, configurable: true };
  },
  has() { return true; },
  get() { return 1; },
});
console.log(p);  // Outputs '{}'

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

Always

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

Ideally, the output would include all enumerable properties, just like it would with a normal, non-proxy object.

What do you see instead?

{} ... omitting the enumerable ownKeys

Additional information

No response

Activity

  1. jasnell commented on Dec 5, 2025

    @jasnell
    jasnell
    on Dec 5, 2025
    MemberAuthor
    More actions

    /cc @BridgeAR

  2. benjamingr commented on Dec 7, 2025

    @benjamingr
    benjamingr
    on Dec 7, 2025
    Member
    More actions

    So:

    • Check if an object is a proxy (isProxy with the internal API)
    • If it is, call ObjectKeys on it and format those values like other objects.

    This would be related to #26241 which made the code stricter and not looser (see #10731 ).

    IIRC util.inspect does have showProxies but that wouldn't work in this case since it'd just show the original object (empty) and the definition/fact there is ownKeys.

    So - the question is "can we determine if calling the proxy traps is side effect free" - maybe if the proxy is tagged well enough we can check kHasSideEffect and if it's side effect free execute it.

  3. BridgeAR commented on Dec 8, 2025

    @BridgeAR
    BridgeAR
    on Dec 8, 2025
    Member
    More actions

    This is working as intended so far. We actively do not trigger any proxy traps.

    We could in theory add another mode that would trigger all proxy traps that the implementation might use, while they could change over time without any guarantee for what proxy traps would be triggered and when.
    I personally do not think we should implement that.

    Figuring out if a proxy trap is side effect free is also impossible, as far as I can tell and it would not overcome the above issue, as well as potentially being confusing for users to trigger traps in some cases while not in others.

  4. BridgeAR
    added
    questionIssues asking questions about Node.js.
    utilIssues and PRs related to the built-in util module.
    feature requestIssues requesting new Node.js features.
    on Dec 8, 2025
  5. github-project-automation
    added this to Node.js feature requestson Dec 8, 2025
  6. github-project-automation
    moved this to Awaiting Triage in Node.js feature requestson Dec 8, 2025
  7. BridgeAR
    removed
    questionIssues asking questions about Node.js.
    on Dec 8, 2025
  8. jasnell commented on Dec 8, 2025

    @jasnell
    jasnell
    on Dec 8, 2025
    MemberAuthor
    More actions

    That's fine, an understandable. At the very least, it might make sense to add some detail to the output so it's at least more helpful than returning {}... something like { [Proxy] } or something that would indicate that there's something unusual with the case would be helpful.

  9. BridgeAR commented on Dec 8, 2025

    @BridgeAR
    BridgeAR
    on Dec 8, 2025
    Member
    More actions

    I checked and Safari, Firefox, and Chrome all show that information by default. So I guess we could indeed show that the object is proxied as well. It does expose some information about it though and I am uncertain if it matches user's expectations in all cases.

    Maybe someone else might want to chime in?

  10. targos commented on Dec 10, 2025

    @targos
    targos
    on Dec 10, 2025
    Member
    More actions

    Showing that the object is proxied SGTM. We could also print the names of the proxy traps that are defined.

  11. BridgeAR commented on Dec 11, 2025

    @BridgeAR
    BridgeAR
    on Dec 11, 2025
    Member
    More actions

    @targos that would effectively result in showProxy option being set to true (it only inspects the traps and logs these methods in addition to inspecting the actual object).

  12. BridgeAR
    added a commit that references this issue on Dec 12, 2025

    util: mark proxied objects as such when inspecting them

    b353576
  13. nodejs-github-bot
    closed this as completedin #61029on Dec 20, 2025
  14. pull
    added a commit that references this issue on Dec 20, 2025

    util: mark proxied objects as such when inspecting them

    dc97b50
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

    feature requestIssues requesting new Node.js features.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    • Node.js feature requests
      Status
      Awaiting Triage
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.