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

Error: TypeError: The "path" argument must be of type string. Received undefined #146

Closed
leigh-johnson opened this issue Nov 27, 2022 · 21 comments · Fixed by #150
Closed
Labels
bug Something isn't working released

Comments

@leigh-johnson
Copy link

Describe the bug

👋 Hey there, thanks for all the hard work on this extension! I'm seeing the following error when I attempt to open a preview using command+shift+p.

2022-11-27 09:56:40.704 [error] TypeError: The "path" argument must be of type string. Received undefined
	at new NodeError (node:internal/errors:371:5)
	at validateString (node:internal/validators:120:11)
	at Object.dirname (node:path:1276:5)
	at a (/home/leigh/.vscode/extensions/asyncapi.asyncapi-preview-0.4.0/dist/extension.js:1:179602)
	at /home/leigh/.vscode/extensions/asyncapi.asyncapi-preview-0.4.0/dist/extension.js:1:181584
	at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async s._executeContributedCommand (/snap/code/113/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:92:111367) asyncapi.preview {"value":"asyncapi.asyncapi-preview","_lower":"asyncapi.asyncapi-preview"}

VS Code version:

Version: 1.73.1
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T03:54:53.913Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 5.15.0-53-generic snap
Sandboxed: No

How to Reproduce

  1. Open an async API schema

  2. Press control+shift+p or command+shift-p to open commands

  3. Select Preview AsyncAPI command

  4. I'm getting prompted to open an AsyncAPI file, even though I already have one open in VS Code. I verified my schema is valid via https://studio.asyncapi.com/
    Screenshot from 2022-11-27 10-00-28

  5. After selecting the Async API schema again (even though it's already open in my editor), I'm seeing the following error:
    Screenshot from 2022-11-27 10-03-28

In VSCode's Output under Log (Extension Host) I see the following error:

2022-11-27 10:05:00.129 [error] TypeError: The "path" argument must be of type string. Received undefined
	at new NodeError (node:internal/errors:371:5)
	at validateString (node:internal/validators:120:11)
	at Object.dirname (node:path:1276:5)
	at a (/home/leigh/.vscode/extensions/asyncapi.asyncapi-preview-0.4.0/dist/extension.js:1:179602)
	at /home/leigh/.vscode/extensions/asyncapi.asyncapi-preview-0.4.0/dist/extension.js:1:181584
	at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
	at async s._executeContributedCommand (/snap/code/113/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:92:111367) asyncapi.preview {"value":"asyncapi.asyncapi-preview","_lower":"asyncapi.asyncapi-preview"}

Maybe the extension is unable to find an executable named asyncapi? Unsure how to proceed or how this should be sandboxed. Thanks for looking into this! 🙇‍♀️

Expected behavior

File preview opens in a new panel.

@leigh-johnson leigh-johnson added the bug Something isn't working label Nov 27, 2022
@github-actions
Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@derberg
Copy link
Member

derberg commented Dec 1, 2022

Works well with:

Version: 1.72.2
Commit: d045a5eda657f4d7b676dedbfa7aab8207f8a075
Date: 2022-10-12T22:16:30.254Z (1 mo ago)
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 20.6.0
Sandboxed: No

now I made an upgrade

Version: 1.73.1
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T02:08:38.961Z (3 wks ago)
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 20.6.0
Sandboxed: No

The only different that I can see between our setup os OS. I'm on Mac.

other extensions that support preview work for you? like markdown previewer for example?

and still works, both command+shift+p and also menu
Screenshot 2022-12-01 at 12 47 53

@leigh-johnson
Copy link
Author

Yep, markdown and HTML previews work for me. Is there a way to increase the verbosity of what's logged under Log (Extension Host)?
Screenshot from 2022-12-01 14-17-00

@derberg
Copy link
Member

derberg commented Dec 5, 2022

There is for now just one console.log -> https://github.com/asyncapi/vs-asyncapi-preview/blob/master/src/PreviewWebPanel.ts#L8 but of course more can be added.

You do not see these under Log (Extension Host) but Help -> Toogle Developer Tools and there in the Console

@philCryoport
Copy link

I'm running into this same issue with plugin version 0.4.0:

foo.yaml asyncapi: 2.5.0 id: urn:com.asyncapi.examples.user info: title: User signed-up event version: 0.1.1 channels: user/signedup: publish: message: payload: type: object properties: fullName: type: string email: type: string format: email age: type: integer minimum: 18

The Preview AsyncAPI option appears in the ellipsis (...) menu and works just fine.

However, if I:

  1. cmd-shift-p
  2. choose Preview AsyncAPI
  3. select the file

...the Dev Tools Console shows:

[Extension Host] Setting context for asyncapi.isAsyncAPI true <directory structure removed>/foo.yaml
workbench.desktop.main.js:89
[Extension Host] Opening asyncapi file undefined workbench.desktop.main.js:89

Help?

@ivangsa
Copy link
Collaborator

ivangsa commented Dec 13, 2022

I @philCryoport

I don't have a Mac to test this, but does the editor menu (on the top right corner of you file editor) work for you?

image

@ivangsa
Copy link
Collaborator

ivangsa commented Dec 13, 2022

Hi @leigh-johnson @philCryoport

can you try (unziping and) installing this package and test if it fixes this issue

(to install de vsix, from inside vscode -> right click on the file and select Install Extension VSIX)

asyncapi-preview-0.4.0.vsix.zip

@philCryoport
Copy link

philCryoport commented Dec 13, 2022

Hi @leigh-johnson @philCryoport

can you try (unziping and) installing this package and test if it fixes this issue

(to install de vsix, from inside vscode -> right click on the file and select Install Extension VSIX)

asyncapi-preview-0.4.0.vsix.zip

Hi @ivangsa I'm a little wary of installing a binary file from an untrusted source (please don't take offense, this is a standard precaution). I'll try building your PR and then installing it from there

@philCryoport
Copy link

philCryoport commented Dec 13, 2022

Hi @leigh-johnson @philCryoport
can you try (unziping and) installing this package and test if it fixes this issue
(to install de vsix, from inside vscode -> right click on the file and select Install Extension VSIX)
asyncapi-preview-0.4.0.vsix.zip

Hi @ivangsa I'm a little wary of installing a binary file from an untrusted source (please don't take offense, this is a standard precaution). I'll try building your PR and then installing it from there

@leigh-johnson I pulled your PR and compiled it. No error dialog message...however here's what DevTools showed when I:

  1. Opened the YAML file
  2. Chose Preview AsyncAPI from the ellipsis dropdown in the upper right
[Extension Host] Setting context for asyncapi.isAsyncAPI true /<directory>/foo.yaml
workbench.desktop.main.js:89 [Extension Host] Opening asyncapi file /<directory>/foo.yaml
DevTools failed to load source map: Could not load content for https://ticino.blob.core.windows.net/sourcemaps/cb188d662af4ff5d43505b572b49905a1f0153ad/core/vs/workbench/contrib/webview/browser/pre/service-worker.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

...in comparison, when I do Command Palette and just pick the YAML file from the Open File dialog, then I only get:

workbench.desktop.main.js:89 [Extension Host] Opening asyncapi file /<directory>/foo.yaml

@ivangsa
Copy link
Collaborator

ivangsa commented Dec 14, 2022

I don't see the error locally and I don't know this url https://ticino.blob.core.windows.net/

@philCryoport I suspect this error is unrelated to the asyncapi preview...

@philCryoport
Copy link

I don't see the error locally and I don't know this url https://ticino.blob.core.windows.net/

@philCryoport I suspect this error is unrelated to the asyncapi preview...

Anyhoo -- the fix you put into the code seemed to work. When you get a moment would you please publish a new release?

Thanks!

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 0.4.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@fourlincoln10
Copy link

The marketplace still has version 0.4.0. Will you push 0.4.1 to the marketplace please?

Copy link
Member

derberg commented Jan 12, 2023

This is odd. GitHub action says that it was published:

Publishing 'asyncapi.asyncapi-preview v0.4.1'...
  Extension URL (might take a few minutes): https://marketplace.visualstudio.com/items?itemName=asyncapi.asyncapi-preview
  Published asyncapi.asyncapi-preview v0.4.1.

And in the same run it was successfully published to https://open-vsx.org/extension/asyncapi/asyncapi-preview 🤷‍♂️

And... https://marketplace.visualstudio.com/items?itemName=asyncapi.asyncapi-preview says it was actually updated on 19.12 - which means the day of 0.4.1 release

We need to investigate what this inconsistency happened there

Related CI runs https://github.com/asyncapi/vs-asyncapi-preview/actions/runs/3732414616/jobs/6331836655

Copy link
Member

derberg commented Jan 12, 2023

What I get when I check it in Marketplace as admin

Screenshot 2023-01-12 at 12.57.41.png

Copy link
Member

derberg commented Jan 12, 2023

I honestly do not know why as admin I see latest is 0.4.1 but in marketplace it is 0.4.0

@ivangsa have you even seen stuff like that?

@ivangsa
Copy link
Collaborator

ivangsa commented Jan 12, 2023

in marketplace version 0.4.0 shows publish date 19/12/22 which is odd

I'm guessing that this may be an error in the marketplace..

I downloaded the file and it looks like actually the 0.4.0 version

@ivangsa
Copy link
Collaborator

ivangsa commented Jan 12, 2023

maybe we can redeploy now, and investigate this later... it looks to me like issue on the marketplace...

Copy link
Member

derberg commented Jan 12, 2023

Ok, lets do it. PR opened #152

@derberg
Copy link
Member

derberg commented Jan 13, 2023

@ivangsa you were right, it was some temporary issue on marketplace side. New release was successful.

@fourlincoln10 0.4.2 is out in the wild

@fourlincoln10
Copy link

fourlincoln10 commented Jan 13, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants