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

Extension give error in VSC - Command "dot" failed. MESSAGE:spawn dot ENOENT #1

Open
TinLe opened this issue Mar 12, 2023 · 25 comments
Assignees
Labels
bug Something isn't working

Comments

@TinLe
Copy link

TinLe commented Mar 12, 2023

Screenshot 2023-03-11 at 23 36 35

I opened a .tf file, then Cmd-Shift-p and get the above error. I get a blank Terraform Live Graph pane on the right side of my .tf code in VSC.

I am using Terraform Live Graph v0.0.1

OSX 13.2.1
Macbook M2 Pro
Visual Code Studio:

Version: 1.76.1 (Universal)
Commit: 5e805b79fcb6ba4c2d23712967df89a089da575b
Date: 2023-03-08T16:32:09.831Z (3 days ago)
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Darwin arm64 22.3.0
Sandboxed: No

Terraform v1.4.0 on darwin_arm64

@TinLe
Copy link
Author

TinLe commented Mar 12, 2023

Looks like this extension requires graphviz installed. I've installed graphviz via homebrew on my Macbook and I do not get that error anymore

Fix by:
brew install graphviz

However, the Terraform Live Graph pane is blank. No graphs.

@adamiBs
Copy link
Owner

adamiBs commented Mar 12, 2023

Hi
Can you successfully execute terraform graph in the working directory of your project?

@adamiBs
Copy link
Owner

adamiBs commented Mar 13, 2023

After looking into this I can conclude that this is a bug, a dependency of the one of the extension's dependencies is an installation of graphviz. I'll work on fixing the issue and removing dependance on graphviz, and in the meanwhile I'll update the README.md installation instructions.

@TinLe
Copy link
Author

TinLe commented Mar 13, 2023

Hi Can you successfully execute terraform graph in the working directory of your project?

Yes. That works fine in any of the directory that contains .tf of my repo.

adamiBs added a commit that referenced this issue Mar 13, 2023
Update installation guide in accordance with #1
@kevinmccurdybrd
Copy link

@adamiBs this is still outstanding for me on a machine with TF 1.4.0 and GraphViz 7.1.0 on WIndows 10 22H2. I can successfully run a TF Graph in the directory with my TF files.

@blckpythn
Copy link

Also having this issue. TF 1.4, GraphViz 7.1.
terraform graph runs fine.
image

@adamiBs
Copy link
Owner

adamiBs commented Mar 14, 2023

Hi @blckpythn,
I'll look into this. It's quite hard to debug according to the error message. I've created and issue that includes improving error logging for the command execution: #6.
BTW, #6 is a good first issue =).

@adamiBs adamiBs added the bug Something isn't working label Mar 14, 2023
@adamiBs
Copy link
Owner

adamiBs commented Mar 14, 2023

Also having this issue. TF 1.4, GraphViz 7.1. terraform graph runs fine. image

Could you please provide the OS information of where your vscode is running?

@blckpythn
Copy link

Also having this issue. TF 1.4, GraphViz 7.1. terraform graph runs fine. image

Could you please provide the OS information of where your vscode is running?

Windows 10 22H2

@Lito-Frito
Copy link

Hello @adamiBs . Thank you for making such a cool extension! Unfortunately I'm having similar issues as those above mentioned. I figured I'd post my issue/setup in case it helps others troubleshoot too.

name about title labels assignees
Issue #1 Create a report to help us improve [BUG]: vscode-terraform-live-graph graph doesn't populate  

Describe the bug While `terraform graph` works just fine in CLI, the extension Terraform Live Graph doesn't work. I got a similar message as the one [above](https://github.com//issues/1#issue-1620267017) about cmd dot failing. .

To Reproduce Steps to reproduce the behavior:

  1. Open VSC
  2. Click on any .tf file (formatted & validatedby terraform itself via `terraform fmt -recursive` and `terraform validate`)
  3. Then open the cmd pallete and use Terraform Live Graph extension
  4. The graph doesn't populate but `terraform graph` does work

Expected behavior For the extension to successfully graph my infrastructure as `terraform graph` does

Screenshots ![image](https://user-images.githubusercontent.com/56422761/225164253-420c2b73-baed-4b2a-b0ca-3f3d5b274123.png) Looking at the 3 columns (left to right), you can see that I have .tf files open. I also opened the live graph extension via the cmd pallete. And to confirm files are valid/TF is working fine, `terraform graph` output is shown in last column

Versions (please complete the following information):

  • OS: [Linux Mint 20.3 x86_64]
  • VSCode Version: [1.76.1]
  • Terraform Live Graph Extension for VSCode Version [v0.0.2]
  • Terraform Version: [v1.4.0]

Additional context I've restarted Code, my computer, and have ensured that graphviz is installed on my machine (2.42.2-3build2). I've also tried a different Terraform codebase and nothing was still graphed (via the extension).

@adamiBs adamiBs self-assigned this Mar 15, 2023
@adamiBs
Copy link
Owner

adamiBs commented Mar 15, 2023

Hi @crc8109 & @TinLe,
Could you please post the Extension Host log?
It's reachable through the Command Palette (CMD+Shift+P / Ctrl+Shift+P): Select "Developer: Show Logs..." and then "Extension Host".
This should open a window with additional context, usually.

@blckpythn
Copy link

Is this what you're looking for?

2023-03-15 09:02:49.531 [info] ExtensionService#_doActivateExtension adamiBs.terraform-live-graph, startup: false, activationEvent: 'onCommand:terraform-live-graph.generateGraphView'
2023-03-15 09:02:49.549 [error] TypeError: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Error
	at new NodeError (node:internal/errors:371:5)
	at _write (node:internal/streams/writable:312:13)
	at Writable.write (node:internal/streams/writable:334:10)
	at Readable.ondata (node:internal/streams/readable:754:22)
	at Readable.emit (node:events:526:28)
	at Readable.emit (node:domain:475:12)
	at Readable.read (node:internal/streams/readable:527:10)
	at flow (node:internal/streams/readable:1011:34)
	at resume_ (node:internal/streams/readable:992:3)
	at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

@adamiBs
Copy link
Owner

adamiBs commented Mar 15, 2023

Exactly 😁.
I think that a fix I’ve implemented in the newest version for this issue #2. Should resolve this. Please check by using the latest version.

@blckpythn
Copy link

Same issue with .0.0.4 unfortunately :(
image

@adamiBs
Copy link
Owner

adamiBs commented Mar 15, 2023

I’ll look into it, thanks for the quick response.

@blckpythn
Copy link

Does the extension try to run terraform graph in the system context?
My user environment PATH has terraform and graphviz entries, but system does not.

@Lito-Frito
Copy link

Hi @crc8109 & @TinLe, Could you please post the Extension Host log? It's reachable through the Command Palette (CMD+Shift+P / Ctrl+Shift+P): Select "Developer: Show Logs..." and then "Extension Host". This should open a window with additional context, usually.

Hello @adamiBs . Here's the output related to the extension:

2023-03-15 14:29:42.248 [info] ExtensionService#_doActivateExtension adamiBs.terraform-live-graph, startup: false, activationEvent: 'onCommand:terraform-live-graph.generateGraphView'

adamiBs added a commit that referenced this issue Mar 16, 2023
Improve stream management while executing system commands. #6 #2 #1
@adamiBs
Copy link
Owner

adamiBs commented Mar 16, 2023

I've done the following in v0.0.5:

  1. Improved error logging to hopefully find the root cause of the issue (if it still exists), and future issues.
  2. I've changes the implementation of spawning dot commands from the graphviz library.

Please check version v0.0.5 and update on any new information.

@blckpythn
Copy link

Not much different, except less error info.
image

@adamiBs
Copy link
Owner

adamiBs commented Mar 16, 2023

Not much different, except less error info.
image

Ok, it seems unrelated specifically to execution of dot commands. Maybe your initial assumption is correct - maybe the extension is running in a different context than your user's context 🤔. Are you initializing VS Code 'as administrator'? If so, I assume the program's context is effected.

Do terraform commands work from the VS Code terminal?

@blckpythn
Copy link

Terraform commands do work, whether I run as administrator or not.
I get the same behavior from the extension running normally or as admin, though I'm usually running as admin.

@TinLe
Copy link
Author

TinLe commented Mar 16, 2023

Hi @crc8109 & @TinLe, Could you please post the Extension Host log? It's reachable through the Command Palette (CMD+Shift+P / Ctrl+Shift+P): Select "Developer: Show Logs..." and then "Extension Host". This should open a window with additional context, usually.

Here is the log output:

2023-03-16 10:25:07.076 [info] Extension host with pid 17186 started
2023-03-16 10:25:07.076 [info] Skipping acquiring lock for /Users/tinle/Library/Application Support/Code/User/workspaceStorage/a93668e7e279b7a75a24e7cab46139c7.
2023-03-16 10:25:07.132 [info] ExtensionService#_doActivateExtension hashicorp.terraform, startup: false, activationEvent: 'onLanguage:terraform'
2023-03-16 10:25:07.654 [info] ExtensionService#_doActivateExtension googlecloudtools.cloudcode, startup: false, activationEvent: 'onLanguage:Log'
2023-03-16 10:25:08.122 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
2023-03-16 10:25:08.148 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2023-03-16 10:25:08.450 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2023-03-16 10:25:08.489 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2023-03-16 10:25:08.548 [info] ExtensionService#_doActivateExtension cschleiden.vscode-github-actions, startup: true, activationEvent: 'workspaceContains:**/.github/workflows/**'
2023-03-16 10:25:08.631 [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
2023-03-16 10:25:08.736 [info] Eager extensions activated
2023-03-16 10:25:08.745 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2023-03-16 10:25:08.746 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2023-03-16 10:25:08.853 [info] ExtensionService#_doActivateExtension GitHub.vscode-pull-request-github, startup: false, activationEvent: 'onStartupFinished'
2023-03-16 10:25:08.909 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished'
2023-03-16 10:25:09.138 [info] ExtensionService#_doActivateExtension vscode.configuration-editing, startup: false, activationEvent: 'onLanguage:jsonc'
2023-03-16 10:25:09.145 [info] ExtensionService#_doActivateExtension vscode.json-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2023-03-16 10:25:09.176 [info] ExtensionService#_doActivateExtension vscode.typescript-language-features, startup: false, activationEvent: 'onLanguage:jsonc'
2023-03-16 10:25:09.437 [warning] [Decorations] CAPPING events from decorations provider vscode.git 447
2023-03-16 10:25:09.785 [warning] [Decorations] CAPPING events from decorations provider vscode.git 447
2023-03-16 10:25:32.984 [info] ExtensionService#_doActivateExtension adamiBs.terraform-live-graph, startup: false, activationEvent: 'onCommand:terraform-live-graph.generateGraphView'

The right pane for Terraform Live Graph has a single square white dot at the top.

@Lito-Frito
Copy link

Lito-Frito commented Mar 16, 2023

Thanks for trying to patch this so quickly @adamiBs ! I installed the update and ran the same cmds as before. Here's the output:

2023-03-16 09:12:43.110 [error] [hashicorp.terraform] provider FAILED
2023-03-16 09:12:43.111 [error] Error: no reference origin found
	at /home/user/.vscode/extensions/hashicorp.terraform-2.25.4-linux-x64/out/extension.js:1:400132
	at /home/user/.vscode/extensions/hashicorp.terraform-2.25.4-linux-x64/out/extension.js:1:400426
	at Immediate.<anonymous> (/home/user/.vscode/extensions/hashicorp.terraform-2.25.4-linux-x64/out/extension.js:1:400788)
	at process.processImmediate (node:internal/timers:466:21)
2023-03-16 09:12:45.741 [info] ExtensionService#_doActivateExtension adamiBs.terraform-live-graph, startup: false, activationEvent: 'onCommand:terraform-live-graph.generateGraphView'

Please lmk if there's anything else I can do to help

@adamiBs
Copy link
Owner

adamiBs commented Mar 16, 2023

@TinLe

The right pane for Terraform Live Graph has a single square white dot at the top.

It seems as if the extension has loaded correctly. And the small white square is a "correct" state, an immediate workaround would be to reload the extension in a working project.

I will create a new bug to track the issue you've described. #15

@gokhanboranalp
Copy link

Check this. If your state is not local. Another rabbit hole.

Screenshot 2023-10-24 at 1 54 06 PM

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

No branches or pull requests

6 participants