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

Problem saving / opening collections in WSL2 #159

Closed
binaryfire opened this issue May 21, 2023 · 14 comments · Fixed by #1233
Closed

Problem saving / opening collections in WSL2 #159

binaryfire opened this issue May 21, 2023 · 14 comments · Fixed by #1233

Comments

@binaryfire
Copy link

Hi. Great project!

I'm using Windows 11 + WSL2. I've installed the client in Windows and have specified the collection location as \\wsl.localhost\Ubuntu-22.04\home\myhomedir\mycollection. The bruno.json file is created correctly and requests are saved as .bru files but they don't appear in the UI. I'm guessing the format of the path is messing something up.

What is the recommended way of using Bruno with WSL2?

Cheers

@helloanoop
Copy link
Contributor

@binaryfire Glad that you like Bruno !

Need some help to debug this issue.
So the requests are getting created, but not appearing in the UI.

When a .bru file gets created, electron fires an ipc event which gets picked up in the UI layer. You are right that the issue is likely due to the format of the path.

To debug, first you can toggle dev tools (Click on View in Menubar and click on Toggle Developer Tools)
Then enter window.__IS_DEV__ = true in console to support debug logs
Once done, try creating a new request and see if you are getting any logs.

This should help us narrow down the issue on whether the event fire by electron reaches the UI or not.
image

@eblount
Copy link

eblount commented Oct 3, 2023

I'm also experiencing this. In fact, even if I move a working Bruno folder to WSL2 and then open the collection from there, Bruno only shows me the collection name and the folders under it, but no requests at all.

I tried the above steps, enabling dev tools and running window.__IS_DEV__ = true in the console. Unfortunately, no log was created at all in the console when creating new requests.

When removing the collection and re-adding it, there are two addDir events in the log. But again, when adding a request (or apparently loading one when opening a collection), no UI events are firing.

Please let me know how I can help debug this further! Please note that I have my WSL2 mapped as a network drive, but the same issues happen when using a collection on the \\wsl$\ path.

Screenshot 2023-10-03 093702

Edit: I have more info:

When running Bruno.exe from the command line, I was able to see the errors. Pasting them below:

Paste from Command Line
Preferences file is located at: C:\Users\myusr\AppData\Roaming\bruno\preferences.json
watcher add: C:\Users\myusr\OneDrive\Documents\bruno\bruno.json
watcher add: C:\Users\myusr\OneDrive\Documents\bruno\Github.bru
watcher add: C:\Users\myusr\OneDrive\Documents\bruno\Foo\Bar.bru
(node:20976) UnhandledPromiseRejectionWarning: Error: EISDIR: illegal operation on a directory, watch 'Z:/home/myuser/projects/MyProject/resources/api/bruno'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2264:34)
    at createFsWatchInstance (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:119:15)
    at setFsWatchListener (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:331:14)
    at NodeFsHandler._handleDir (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:567:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async NodeFsHandler._addToNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:617:16)
    at async C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\index.js:451:21
    at async Promise.all (index 0)
(Use `Bruno --trace-warnings ...` to show where the warning was created)
(node:20976) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:20976) UnhandledPromiseRejectionWarning: Error: EISDIR: illegal operation on a directory, watch 'Z:\home\myuser\projects\MyProject\resources\api\bruno\bruno.json'    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2264:34)
    at createFsWatchInstance (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:119:15)
    at setFsWatchListener (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:331:14)
    at NodeFsHandler._handleFile (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:395:23)
    at NodeFsHandler._addToNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:637:21)
(node:20976) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:20976) UnhandledPromiseRejectionWarning: Error: EISDIR: illegal operation on a directory, watch 'Z:\home\myuser\projects\MyProject\resources\api\bruno\Github.bru'    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2264:34)
    at createFsWatchInstance (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:119:15)
    at setFsWatchListener (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:331:14)
    at NodeFsHandler._handleFile (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:395:23)
    at NodeFsHandler._addToNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:637:21)
(node:20976) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:20976) UnhandledPromiseRejectionWarning: Error: EISDIR: illegal operation on a directory, watch 'Z:\home\myuser\projects\MyProject\resources\api\bruno\Foo'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2264:34)
    at createFsWatchInstance (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:119:15)
    at setFsWatchListener (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:331:14)
    at NodeFsHandler._handleDir (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:567:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async NodeFsHandler._addToNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:617:16)
(node:20976) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:20976) UnhandledPromiseRejectionWarning: Error: EISDIR: illegal operation on a directory, watch 'Z:\home\myuser\projects\MyProject\resources\api\bruno\Foo\Baz.bru'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2264:34)
    at createFsWatchInstance (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:119:15)
    at setFsWatchListener (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:331:14)
    at NodeFsHandler._handleFile (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:395:23)
    at NodeFsHandler._addToNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:637:21)
(node:20976) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:20976) UnhandledPromiseRejectionWarning: Error: EISDIR: illegal operation on a directory, watch 'Z:\home\myuser\projects\MyProject\resources\api\bruno\Foo\Bar.bru'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2264:34)
    at createFsWatchInstance (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:119:15)
    at setFsWatchListener (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:331:14)
    at NodeFsHandler._handleFile (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:395:23)
    at NodeFsHandler._addToNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:637:21)
(node:20976) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)
(node:20976) UnhandledPromiseRejectionWarning: Error: EISDIR: illegal operation on a directory, watch 'Z:\home\myuser\projects\MyProject\resources\api\bruno\Foo\Biz.bru'
    at FSWatcher.<computed> (node:internal/fs/watchers:244:19)
    at Object.watch (node:fs:2264:34)
    at createFsWatchInstance (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:119:15)
    at setFsWatchListener (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:166:15)
    at NodeFsHandler._watchWithNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:331:14)
    at NodeFsHandler._handleFile (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:395:23)
    at NodeFsHandler._addToNodeFs (C:\Users\myusr\AppData\Local\Programs\bruno\resources\app.asar\node_modules\chokidar\lib\nodefs-handler.js:637:21)
(node:20976) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 7)

@nicklargent
Copy link

I just ran into this same issue. Decided to dig into the source a little and found this...

The issue appears to be a result of using fs.watch which isn't recommended for network paths (and WSL is accessed via network path).

A simple workaround is to set the environment variable CHOKIDAR_USEPOLLING=true before launching bruno. This avoids the issue but means that all folders use polling though which could be less efficient for large projects.

A more permanent fix could be conditionally setting the polling mode based on the path type. In watcher.js:415 the parameter usePolling: false could do something like usePolling: watchPath.startsWith("\\\\") ? true : false,

@SpiRanha
Copy link

Alternatively, if you validate the prerequisites for running GUI apps from WSL2, you can run bruno as GUI from the WSL itself and it seems to just work fine.

@Nikolai2038
Copy link

Alternatively, if you validate the prerequisites for running GUI apps from WSL2, you can run bruno as GUI from the WSL itself and it seems to just work fine.

Yep, installing Bruno in WSL directly (I used apt) worked for me, thanks!

@GimpMaster
Copy link

Came here to say WSL paths do not work. Glad I'm not the only one. Hopefully one day bruno will support this.

@helloanoop
Copy link
Contributor

@binaryfire @eblount @nicklargent @SpiRanha @GimpMaster This has been fixed in v1.5.1 Can you download and check if it solves the issue ?

@gyunseo Many thanks for the PR!

@binaryfire
Copy link
Author

Hey @helloanoop. Only had time to do a quick test but so far so good! I'll let you know if I have any other problems.

@eblount
Copy link

eblount commented Dec 23, 2023

@helloanoop I don't see any change here, sorry:

  • Installed 1.5.1 in Windows
  • Created a new collection with the folder in WSL2
  • Created a new request
  • Request doesn't appear in the Bruno sidebar
  • Request file is in the directory in WSL2
  • Restarted Bruno, same result: Collection is there, request is not

@GimpMaster
Copy link

@eblount

1.5.1 worked just fine for me.

image

Basically clicked create new collection. Choose \wsl$.localhost\Ubuntu\tmp\bruno

Created a request and it showed up.
Did a GET request on google.com and it pulled down the webpage and rendered it.
Closed Bruno and re-opened and it still remained there.

Thanks @helloanoop

@eblount
Copy link

eblount commented Dec 24, 2023

Okay, using the \\wsl.localhost\... path did work. I have my WSL distro mapped to a drive letter, and that was what I used last time. I can confirm that using the network path to WSL does work with 1.5.1. Thanks for the suggestion, @GimpMaster, and for the update @helloanoop

@nicklargent
Copy link

Works over here too, thanks! No more workaround.

@binaryfire
Copy link
Author

Is anyone else having problems renaming folders on WSL2? It'd be great if someone could test this and let me know - I'm not sure if it's a bug or if it's something to do with my system.

To reproduce: right click on a folder inside a collection, click "Rename" and try and change the name to something else. The name doesn't change.

@binaryfire
Copy link
Author

I've opened a new issue here: #1302

Looks like there are issues with several file operations in WSL2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants