vscode-terraform-live-graph icon indicating copy to clipboard operation
vscode-terraform-live-graph copied to clipboard

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

Open TinLe opened this issue 1 year ago • 25 comments

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 avatar Mar 12 '23 07:03 TinLe

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.

TinLe avatar Mar 12 '23 18:03 TinLe

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

adamiBs avatar Mar 12 '23 21:03 adamiBs

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.

adamiBs avatar Mar 13 '23 06:03 adamiBs

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.

TinLe avatar Mar 13 '23 06:03 TinLe

@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.

kevinmccurdybrd avatar Mar 13 '23 18:03 kevinmccurdybrd

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

blckpythn avatar Mar 14 '23 13:03 blckpythn

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 avatar Mar 14 '23 13:03 adamiBs

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?

adamiBs avatar Mar 14 '23 13:03 adamiBs

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

blckpythn avatar Mar 14 '23 14:03 blckpythn

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/adamiBs/vscode-terraform-live-graph/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).

Lito-Frito avatar Mar 14 '23 23:03 Lito-Frito

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.

adamiBs avatar Mar 15 '23 06:03 adamiBs

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)

blckpythn avatar Mar 15 '23 14:03 blckpythn

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.

adamiBs avatar Mar 15 '23 14:03 adamiBs

Same issue with .0.0.4 unfortunately :( image

blckpythn avatar Mar 15 '23 14:03 blckpythn

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

adamiBs avatar Mar 15 '23 15:03 adamiBs

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.

blckpythn avatar Mar 15 '23 16:03 blckpythn

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'

Lito-Frito avatar Mar 15 '23 21:03 Lito-Frito

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.

adamiBs avatar Mar 16 '23 15:03 adamiBs

Not much different, except less error info. image

blckpythn avatar Mar 16 '23 15:03 blckpythn

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?

adamiBs avatar Mar 16 '23 15:03 adamiBs

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.

blckpythn avatar Mar 16 '23 16:03 blckpythn

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.

TinLe avatar Mar 16 '23 17:03 TinLe

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

Lito-Frito avatar Mar 16 '23 17:03 Lito-Frito

@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

adamiBs avatar Mar 16 '23 22:03 adamiBs

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

Screenshot 2023-10-24 at 1 54 06 PM

gokhanboranalp avatar Oct 24 '23 10:10 gokhanboranalp