Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /json Endpoint to Bun Inspector Server to Support External Debugging Tools #9609

Open
june07 opened this issue Mar 25, 2024 · 0 comments
Labels
debugger Something to do with `bun --inspect` or the debugger enhancement New feature or request

Comments

@june07
Copy link

june07 commented Mar 25, 2024

What is the problem this feature would solve?

Currently debugging with Chromium DevTools is possible but a manual copy paste of the debug socket is needed as you can see from the first screenshot where I copy/pasted "localhost:4000/7u1bqmpvhg" into DevTools. https://github.com/june07/nim is a tool I wrote for Node.js (works for Deno as well) some years back for this and it would be nice to use it for Bun as well, to streamline things.

image

Node/Deno both implement inspect servers that have a json endpoint which contains data about the debug websocket:

For example, http://localhost:9229/json will display this output which allows local clients to determine the debugger web socket details so as to connect: ws=localhost:9229/abcdbdb5-f00c-4554-88e5-d740ba881234"

[
    {
        "description": "node.js instance",
        "devtoolsFrontendUrl": "devtools://devtools/bundled/js_app.html?experiments=true&v8only=true&ws=localhost:9229/abcdbdb5-f00c-4554-88e5-d740ba881234",
        "devtoolsFrontendUrlCompat": "devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=localhost:9229/abcdbdb5-f00c-4554-88e5-d740ba881234",
        "faviconUrl": "https://nodejs.org/static/images/favicons/favicon.ico",
        "id": "565ebdb5-f00c-4554-88e5-d740ba88bf28",
        "title": "src/index.js",
        "type": "node",
        "url": "file:///usr/src/node-app/src/index.js",
        "webSocketDebuggerUrl": "ws://localhost:9247/565ebdb5-f00c-4554-88e5-d740ba88bf28"
    }
]

I'm sure those reading this are familar with this in Node... but in case not: https://nodejs.org/en/learn/getting-started/debugging
image

What is the feature you are proposing to solve the problem?

Implement the same inspector sever /json endpoint

What alternatives have you considered?

No response

@june07 june07 added the enhancement New feature or request label Mar 25, 2024
@Electroid Electroid added the debugger Something to do with `bun --inspect` or the debugger label Mar 26, 2024
@Electroid Electroid changed the title Inspect debug server similar to Node/Deno for easier debugger port/id introspection Support V8 DevTools protocol Mar 26, 2024
@june07 june07 changed the title Support V8 DevTools protocol Add /json Endpoint to Bun Inspector Server to Support External Debugging Tools Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger Something to do with `bun --inspect` or the debugger enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants