-
Notifications
You must be signed in to change notification settings - Fork 3.1k
It is impossible do inspect Bun application inside docker using vscode #7490
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
Comments
Hey any news on this one? |
If you manually insert a I captured the websocket communication using Wireshark just to confirm.
{"id":6,"method":"Debugger.setBreakpointByUrl","params":{"url":"/home/matthew/Projects/bun-test/src/main.ts","lineNumber":0}}
{"result":{"breakpointId":"/home/matthew/Projects/bun-test/src/main.ts:0:0","locations":[]},"id":6}
{"method":"Debugger.scriptParsed","params":{"scriptId":"1533","url":"/usr/src/app/src/main.ts","startLine":0,"startColumn":0,"endLine":11,"endColumn":0,"isContentScript":false,"sourceURL":"/usr/src/app/src/main.ts","sourceMapURL":"[...]", ...
{"method":"Debugger.paused","params": {"callFrames": [{"callFrameId": "{\"ordinal\":0,\"injectedScriptId\":1}","functionName": "","location": {"scriptId": "1533", ...
In this example case, setting |
I wanted to submit a patch myself, this seems like an easy fix, but I never touched Bun code base so I have no idea where to add my fix. I will leave it to the developers. @ZeldOcarina @matepaiva |
There's an easier fix I've applied: I switched everything to npm! |
😆😆😆 Yeah, I guess Bun is not ready to be a plug&play Node.js replacement... I hope it will eventually get there! |
Will this get fixed anytime soon? |
This was actually a really good fix for us. While beeing hacky, we build a portable solution. This is our dockerfile (which also shows build secrets, which works also with the solution) ARG BUN_VERSION=1.1.26
FROM oven/bun:${BUN_VERSION}-alpine as development
ARG WORKDIR_ENV
WORKDIR ${WORKDIR_ENV}
COPY package.json bunfig.toml bun.lockb ./
RUN --mount=type=secret,id=gitlab_npmrc,target=${WORKDIR_ENV}/.npmrc bun install --ignore-scripts --frozen-lockfile Now you can set in your docker-compose file. Important: You have to expose the LOCAL_PWD env var to your system. We did not found a way that docker-compose could infer the pwd correctly. In your build pipeline you can now expose e.g. build:
context: .
dockerfile: '.docker/Dockerfile.node'
target: development
args:
- WORKDIR_ENV=$LOCAL_PWD This is the launch config we use: {
"version": "0.2.0",
"configurations": [
{
"name": "bun (docker)",
"type": "bun",
"request": "attach",
"url": "ws://localhost:6499/tq1bwri63p",
}
]
}
We still would be happy if bun fixes this by adding the the root properties |
is nobody using bun in docker? i'm very frustrated the debug id in the url can be fixed with a custom prefix, eg:
with this config & the docker container running in {
"version": "0.2.0",
"configurations": [
{
"type": "bun",
"request": "attach",
"name": "Attach to Bun",
"url": "ws://127.0.0.1:6499/debug",
}
]
}
|
Use tsx, it's great for debugging in VSCode! |
What version of Bun is running?
docker oven/bun:1-slim
What platform is your computer?
docker
What steps can reproduce the bug?
"watch": "bun --hot --inspect=ws://0.0.0.0:6499/forcingPrefix index.ts "
docker compose up
.vscode/launch.json
like:What is the expected behavior?
I should be able to inspect a bun application inside a docker via websocket, but it does not work as supposed.
What do you see instead?
I can inspect it using the web bun debugger, but it does not work at vscode.
Additional information
Instead of "0.0.0.0", I tried to pass different values to inspect (at package.json and at launch.json), like "localhost" or "127.0.0.1". It does not work.
The text was updated successfully, but these errors were encountered: