-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[win] Debugging/running on VSCode on Windows doesn't work #8851
Comments
Yea, Windows doesn't support UNIX sockets. We'll have to fix this in the VSCode extension |
I've tried, Bun has no issues with UNIX sockets on Windows (which have supported them since around 2017). The following code runs fine on my Windows machine import * as net from "net"
import { userInfo } from "os";
let responded = false;
var server = net.createServer(function (socket) {
socket.on("data", function (data) {
let message = data.toString();
console.log("Message received from client: " + message);
socket.write("Hello " + message + " !");
responded = true;
})
})
server.listen("./test.sock");
let client = net.connect("./test.sock").
on('data', (data) => {
let message = data.toString();
console.log("Message received from server: " + message);
})
client.write(userInfo().username);
while (!responded) {
await Bun.sleep(10);
}
client.destroy();
server.close(); Unless the websocket debugger falls into one of the unsupported type of socket, I think the root cause is elsewhere. Also of note, Bun supports UNIX Sockets on Windows, while NodeJS doesn't even bother :D |
This issue still exist with the 1.1 stable version on Windows. |
Same issue here for 1.1 on Windows |
Having the same exact issue on 1.1.0, any news on this? |
1.1.3 the same |
The problem is still here.
|
Having the same issue. Hope this issue gets priority. |
try half a day,and finally get here.hope to solve the bug |
Bug reproduced in 1.1.9. |
having this issue in 1.1.9 too |
Confirming this does not work. We haven't had time to address this yet. The strange thing is we do support unix domain sockets on Windows. So it's something most likely to do with the VSCode extension. If a contributor wants to investigate this: Debugger is initialized here: Lines 1217 to 1235 in af4e844
The debugger thread's JS is here: bun/src/js/internal/debugger.ts Lines 266 to 296 in af4e844
It's expecting an environment variable named Lines 1578 to 1580 in af4e844
|
This problem appears to be related to URL parsing on Windows. For example, > new URL('ws+unix://C:\\test\\folder')
Uncaught TypeError: Invalid URL
at new URL (node:internal/url:797:36) {
code: 'ERR_INVALID_URL',
input: 'ws+unix://C:\\test\\folder'
} Node treats all backslashs in URLs as invalid(except for certain protocols like > new URL('ws+unix://C:/test/folder')
URL {
href: 'ws+unix://C/test/folder',
protocol: 'ws+unix:',
host: 'C',
hostname: 'C',
pathname: '/test/folder',
...
} However this introduces a new problem: the driver letter > new URL('ws+unix:///C:/test/folder')
URL {
href: 'ws+unix:///C:/test/folder',
protocol: 'ws+unix:',
pathname: '/C:/test/folder',
...
} There's still an extra slash before the pathname, causing These are the issues I attempted to fix in the PR, but I'm uncertain if the changes in |
Any update on a fix for this? I am having the same problem. |
Hurry up, please |
Let's go guys! |
I'm having the same problem
|
I still have this issue |
Still the case on 1.1.21-canary.1+738947bde |
Brother, hasn't this problem been solved yet? If it's resolved, you should update the new version immediately |
Reposting here from the other issue: You can attach with the following config in launch.json:
...and then running bun --inspect-brk=127.0.0.1:5000/test test.ts and then launching the debugger. But once attached there is no output in the debugger console and breakpoints do not get hit. Stepping through the code with F10 evaluates the code line by line, though, but without giving any visual feedback or variables in the debug panel of VSCode. So there are a lot more issues to be fixed beyond the initial connection problem. But maybe it works for someone else? |
Hopefully this gets sorted out soon. I closed a duplicate issue of this today. I did not see this issue when I created the duplicate. Closed duplicate issue #12735. Node is getting typescript first class as well. Surely Bun supports this before Node JS officially does. |
I assume you are using WSL? Debugging any TS doesn't work for me. Can you provide information on your setup/OS/etc? |
No I confirm, it was running natively on Windows, not via WSL. Setup is still in the OP 🙂 |
@Jarred-Sumner I replaced the The only problem which I'm not stuck is no permission error. It seems that the sock files get created, but no write/read permissions.
Note to the stack trace: I hardcoded the prefix Any idea? EDIT: Now I saw the #11378 seems to already try to fix it. It seems that unix socket do not really work on Windows (no WSL). |
I assumed you were talking about debugging, as that's the issue that is actually still present 🙂. |
Why not use standard Then update signal.ts to match this change? And possibly rename I am not familiar with all the project code so this is may not be possible, but thought to mention. I also mentioned something similar when I accidentally duplicated this issue. UpdateLooks like this implementation is currently being tried thanks to @mikeseese |
I Have the same issue. |
Yall can 👍 the original post of this issue to show your desire to get this fixed/add that you are experiencing the issue. Not to be that guy, but if you're trying to use Bun on Windows without WSL given any combination of JS frameworks/etc, the VSCode extension debugger will not work for you (and won't work until this issue gets closed or otherwise mentioned). Let's keep people's inboxes reserved for productive discussion on the issue. Thanks! |
I've tried
|
I've gotten a WebSocket-only protocol to work with Windows with this branch: https://github.com/mikeseese/bun/tree/feat/win-debugger, but it requires 20240803_002646.mp4Stack frames, variable inspection, and breakpoints don't seem to be working yet. I will probably take a break for several days/couple weeks on this if someone wants to pick up where I left off. Let me know if you start working on it so I don't duplicate effort. You will need to be able build Bun for windows and use the updated |
I tried to make the vscode debugger works on windows recently. But
After the above changes, now the vscode debugger run without errors. But it's also couldn't stop at the breakpoints, it seems just no response. See also #13071 (comment). |
Still happens in version 1.1.26 of Bun. Debugger starts and immediatley exits, no way to debug any code. |
@gemue-parndt yup, it wouldn't work on the latest version because a fix hasn't been submitted yet. If a fix was submitted and merged, this issue would have been closed. |
Does anyone know how to debug your code in the editor right now? |
Use ts-node or tsx? |
🎉 |
It just merged few hours ago, I think you should wait for a new version released. |
What version of Bun is running?
1.0.26-canary.51+2264bb3d0
What platform is your computer?
Microsoft Windows NT 10.0.22631.0 x64
What steps can reproduce the bug?
Install the official Bun VSCode Extension.
Configure the recommended
.vscode/launch.json
fileCreate a JS or TS file, and either run "Run File" or "Debug File"
What is the expected behavior?
It should be possible to run or debug the script inside VSCode
What do you see instead?
The debugging/running immediately stops, with this error appearing in the debug console:
Additional information
Bun extension version: v0.0.12
VSCode "about" window:
The text was updated successfully, but these errors were encountered: