AnWeber / httpbook

Quickly and easily send REST, Soap, GraphQL, GRPC, MQTT and WebSocket requests directly within Visual Studio Code
https://httpyac.github.io/
MIT License
58 stars 4 forks source link

cannot use external javascript packages when testing while using vscode remotely #43

Closed IvoLeist closed 2 years ago

IvoLeist commented 2 years ago

Dear AnWeber,

first of all thank you for that amazing vscode extension!

Unfortunately, I found a really weird bug happening when testing with e,g, "assert" or "chai" an endpoint while using vscode remotely. See error message below:

TypeError: Cannot assign to read only property '_fsPath' of object '[object Object]' at v.get fsPath [as fsPath] (/home/ivo/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/out/vs/server/remoteExtensionHostProcess.js:73:14942) at Object.ni.io.fileProvider.fsPath (/home/ivo/.vscode-server/extensions/anweber.vscode-httpyac-4.10.0/dist/extension.js:274:7580) at E2 (/home/ivo/.vscode-server/extensions/anweber.vscode-httpyac-4.10.0/dist/extension.js:126:90247) at Uh (/home/ivo/.vscode-server/extensions/anweber.vscode-httpyac-4.10.0/dist/extension.js:127:29305) at Object.action (/home/ivo/.vscode-server/extensions/anweber.vscode-httpyac-4.10.0/dist/extension.js:127:28669) at l5. (/home/ivo/.vscode-server/extensions/anweber.vscode-httpyac-4.10.0/dist/extension.js:1:4676) at Generator.next () at s (/home/ivo/.vscode-server/extensions/anweber.vscode-httpyac-4.10.0/dist/extension.js:1:3138) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5)

How to reproduce: In VS Code, select Remote-SSH: Connect to Host.

GET http://localhost:8080/api/test
{{
  const { equal } = require('assert');
  test('status code 200', () => {
    equal(response.statusCode, 200);
});

What I figured out so far:

If it helps to know: OS: Manjaro Linux x86_64 vscode: aur/visual-studio-code-bin 1.63.2-1

Let me know if you need some extra information from me. Keep up the good work :v:

Ivo

AnWeber commented 2 years ago
IvoLeist commented 2 years ago

Thank you for the quick reply :)

The small error in the example was a copy & paste issue. I took that snippet from a bigger code block and forgot the closing brackets.

Oh nice I was not aware yet of that helper function. Cool to know but unfortunately runs into the same error.

Nevertheless, it looks like that double checking the httpYac Rest client extension status was a good hint.

I tried restarting the httpBook extension which does not help but this seems to work:

Now it should work again.

Not sure if my collection of vscode extensions causes that but or if that is a general issue?

If the latter it might be worth implementing something which catches this error and then automatically restart the httpYac Rest client extension(?)

Anyway for now you can close this issue if you want.

AnWeber commented 2 years ago

I was able to recreate the behavior. I would still like to understand what is causing the error. Other extension are certainly not to blame at this point. I think it is rather a mishandling of the virtual workspace on my part. The use of fspath is not allowed in this case. Why the call occurs anyway, I still have to check.

AnWeber commented 2 years ago

Ok, stupid mistake. Cause is the use of fsPath to have the correct file when running the script. Advantage is actually only that so in case of error the correct line is output. I will go over all uses of fsPath once and re-evaluate again.

AnWeber commented 2 years ago

The cause was really the use of fsPath. In this case, however, the scheme would have been correctly file. I now simply catch the exception and use toString instead. This also works for the execution of the scripts. But to fix the error in httpBook, I just need to update the extension vscode-httpyac. Therefore, do not be surprised if there is no new version:-)

IvoLeist commented 2 years ago

Amazing to hear that you managed to reproduce it and fixed it so quickly ! Thanks a lot ;)

Can you already estimate when you plan to release the newest version of vscode-httpyac? *No need to stress, just would like to provide that information when I introduce httpBook to my team.

AnWeber commented 2 years ago

I got distracted by my kids and forgot I need to draft the release of vscode-httpyac. In about 10 minutes the update should arrive. Maybe let me know if it works for you.:-)

IvoLeist commented 2 years ago

Just did a quick check, seems to work now :+1:

AnWeber commented 2 years ago

Amazing to hear that you managed to reproduce it and fixed it so quickly ! Thanks a lot ;)

I was lucky. I have a similar setup in my work and I was able to see the location in the 'uglified' code as well.

*No need to stress, just would like to provide that information when I introduce httpBook to my team.

Discovering and appreciating a tool for yourself is great. But showing it to others is even more praise. thx.