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

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

Closed
IvoLeist opened this issue Jan 28, 2022 · 9 comments

Comments

@IvoLeist
Copy link

IvoLeist commented Jan 28, 2022

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:

  • same happens when I use chai
  • it does not matter if I use a GET or POST
  • error does not occur when running httpyac from the command line

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 ✌️

Ivo

@IvoLeist IvoLeist changed the title cannot use external javascript packages when testing endpoint running on local host while using vscode remotely cannot use external javascript packages when testing endpoint running on localhost while using vscode remotely Jan 28, 2022
@AnWeber
Copy link
Owner

AnWeber commented Jan 28, 2022

  • Does the use of my helper methods work?
GET http://localhost:8080/api/test
{{
  test.status(200);
}}
  • In which environment is the extension installed? This should be enabled on the remote environment.
    image

  • I noticed that there is a small error in the example. But this is probably not the reason

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

@IvoLeist IvoLeist changed the title cannot use external javascript packages when testing endpoint running on localhost while using vscode remotely cannot use external javascript packages when testing while using vscode remotely Jan 29, 2022
@IvoLeist
Copy link
Author

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:

  • select Remote-SSH: Connect to Host
  • disable the httpYac Rest client extension -> accept the reload
  • enable the httpBook client extension

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.

@IvoLeist IvoLeist reopened this Jan 29, 2022
@AnWeber
Copy link
Owner

AnWeber commented Jan 29, 2022

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
Copy link
Owner

AnWeber commented Jan 29, 2022

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
Copy link
Owner

AnWeber commented Jan 30, 2022

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
Copy link
Author

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
Copy link
Owner

AnWeber commented Jan 30, 2022

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
Copy link
Author

Just did a quick check, seems to work now 👍

@AnWeber
Copy link
Owner

AnWeber commented Jan 30, 2022

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.

@AnWeber AnWeber closed this as completed Jan 30, 2022
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

No branches or pull requests

2 participants