Open MansurEsm opened 2 years ago
Hi @MansurEsm thanks for reporting! Which OS are you running on?
I just did a bit of digging and apparently it is an issue if our graph-module (which is a node binary packaged with vercel/pkg) receives unsupported arguments in the form of node environment variables. Do you have specific global environment variables set on your machine that node picks up automatically? We'll have to look into ignoring those, if that ends up being the issue.
This issue is actually documented in vercel/pkg's ReadMe, outlined here. Do you use the NODE_OPTIONS env variable per chance?
Thank you very much replying. Would be great to get the issue solved.
To your questions:
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic $ printenv | grep NODE $
So there are no NODE_OPTIONS defined.
I will try to investigate more. Maybe I find out more.
Running it outside of VS-Code delivers another Issue:
$ pluralith init --api-key --project-id |)| |.|| | |||| (_||| | | |
Welcome to Pluralith!
→ Authentication ✔ API key is valid, you are authenticated!
→ Project Setup ✔ Project ID is valid! ✔ Your project has been initialized! Customize your config in pluralith.yml
$ pluralith graph --title "Mark I" --author "Mansur Esmann" --version "0.0.1" --show-changes ⠿ Exporting Diagram
→ Verify ✔ API key is valid, you are authenticated!
→ Plan ✔ Execution Plan Generated ✔ Secrets Stripped
→ Export ✘ Diagram Generation Failed pluralith-cli-graphing graph
Render graph and export PDF
Options: --help Show help [boolean] --version Show version number [boolean]
Error: ENOENT: no such file or directory, open '/home/ubuntu/Pluralith/credentials'
at Object.openSync (node:fs:585:3)
at Object.openSync (pkg/prelude/bootstrap.js:739:32)
at Object.readFileSync (node:fs:453:35)
at Object.readFileSync (pkg/prelude/bootstrap.js:1025:36)
at /snapshot/pluralith-cli-graphing/dist/build/commands/Graph.js
at Generator.next (
generating diagram failed -> RunGraph: running CLI command failed -> GenerateDiagram: exit status 1
Do I have to create a credentialsfile in the given location "/home/ubuntu/Pluralith/credentials" ?
@MansurEsm hm actually the CLI should create that credentials file for you when you run pluralith login
. Given that it says API key valid, the credentials file should exist. Maybe the node binary we run under the hood for graphing has no access to the /home/ubuntu/Pluralith/credentials
path?
A bunch of interesting issues that we haven't seen before here! This should help fix things up quite a bit
I run it in WSL2. How I could check if the "node binary we run under the hood for graphing" has or has'nt access to ~/ ? The login is successfull and the init as well, but no "~/Pluralith" folder is created.
The NODE_OPTIONS is no issue when I run it outside of vs-code.
Ah I think I know the issue now!
In WSL we store the credentials file on the Windows partition. The Pluralith CLI knows how to detect WSL and look for the credentials file on the Win partition, the graphing module doesn't have that support yet.
Thanks for pointing it out! We'll have to implement that!
Mind if I get back to you on here when we have that figured out?
Hello, I'm having also some issues generating graph:
pluralith graph --var-file='../tfvars/development.tfvars' --show-changes ⠿ Exporting Diagram
→ Verify ✔ API key is valid, you are authenticated!
→ Plan ✔ Execution Plan Generated ✔ Secrets Stripped
→ Export ✘ Diagram Generation Failed pluralith-cli-graphing.exe graph
Render graph and export PDF
Options: --help Show help [boolean] --version Show version number [boolean]
TypeError: Cannot read properties of undefined (reading 'forEach')
at C:\snapshot\pluralith-cli-graphing\dist\build\commands\Graph.js
at Generator.next (
generating diagram failed -> RunGraph: running CLI command failed -> GenerateDiagram: exit status 1
thanks
@maxim-03 Thanks for reporting!
This looks pretty ambiguous, not entirely sure what is going on here. Looks like it can't find the plan state. Could you verify that the following things are present in your project directory right after the failure:
.pluralith
.pluralith/pluralith.plan.bin
.pluralith/pluralith.state.json
Let me know if those are there!
Best, Dan
@MansurEsm we recently released an update of the graphing module specifically for improved WSL support. Would you be up for updating CLI and graph module and testing again?
Cheers, Dan
Hi, same issue as @maxim-03 & @MansurEsm here ; Latest version tested : v0.1.17
Tryed with powershell and git bash :
xxx@xxx MINGW64 /c/development/git/www-sandbox-yyy-fork/config/terraform/yyy/sandbox/scopes/yyy (master)
pluralith.exe run plan --var-file=c:/development/git/www-sandbox-yyy-fork/config/terraform/yyy/sandbox/sandbox.tfvars --var "yyy_access_key=${AWS_ACCESS_KEY}" --var "yyy_secret_key=${AWS_SECRET_KEY}" --show-changes --show-costs --show-drift
⠿ Initiating Plan Run ⇢ Posting To Pluralith Dashboard
→ Branch detected: master
→ Verify
←[94m✔←[0m API key is valid, you are authenticated!
←[94m✔←[0m Project ID is valid!
→ Plan
←[91m✘←[0m Couldn't Generate Execution Plan
Error: error loading state: AccessDenied: Access Denied
status code: 403, request id: KY3WYJ719H3AG108, host id: eaTlIfUrZOHUZo9VSb0Ug+fO3UiBnKCu9/+jgcIc/t6t84rsYZp1GFggofTC3Ug8xGpw1v1HUGs=
running terraform plan failed -> GenerateGraph: RunPlan: exit status 1
←[91m✘←[0m Posting Run To Pluralith Dashboard Failed
reading cache from disk failed -> PostGraph: open C:\development\git\www-sandbox-yyy-fork\config\terraform\yyy\sandbox\scopes\yyy\.pluralith\pluralith.cache.json: The system cannot find the file specified.
Hi @BetterToAutomateTheWorld
Thanks for reporting, will look into it again and report back here 👌
Hi @BetterToAutomateTheWorld
I tried some things on my end to see if I could reproduce, but I couldn't seem to get that 403. This also seems like an issue with Terraform running under our hood. It says error loading state
when we try to generate an execution plan, so it seems like Terraform is having a problem getting your state from somewhere. To get to the bottom of this, it would be super helpful if you could answer a few questions for me:
terraform plan
?terraform plan
are there any special flags you attach to the terraform plan
command?Thank you for your quick answer;
terraform plan
terraform plan --var-file=c:/development/git/www-sandbox-yyy-fork/config/terraform/yyy/sandbox/sandbox.tfvars -var "yyy_access_key=${AWS_ACCESS_KEY}" -var "yyy_secret_key=${AWS_SECRET_KEY}"
Hi @BetterToAutomateTheWorld
Thanks for the details! I'm thinking it might be an issue with how we pass variables through to Terraform. I see you're passing in the AWS credentials as variables. I'm assuming those are being used in the provider block?
We've had issues in the past with quotes (various shenanigans with ' and ") when using the --var
flags. I'll set up a very simple test project to see if I can reproduce.
Yes, you're right, we're using those AWS credentials variables to fill a variable block in Terraform ;
After try : same issue with single or double quotes
@BetterToAutomateTheWorld Will try some more things on my end and report back 👍
@BetterToAutomateTheWorld What does your s3 backend config block in Terraform look like? Feel free to redact anything sensitive, but it might be helpful to see the structure.
@BetterToAutomateTheWorld Ok I think I might be onto something. Are the AWS credentials terraform uses for the backend stored in environment variables?
Graph generation fails. Plan is successful. Indeed the File pluralith.cache.json is not present on the given directory
Dont know what to do here. Any suggestion?
Below the output. Can I deliver further informations? Seems like it ha to to with node.js
$ pluralith run --show-changes ⠿ Initiating Run ⇢ Posting To Pluralith Dashboard → Branch detected: main
→ Verify ✔ API key is valid, you are authenticated! ✔ Project ID is valid! ✔ No graph module installed, found latest release ⠿ None → 0.1.8
Installing Latest Graph Module 100% [██████████████████████████████] (1.396 MB/s)
✔ Graph Module updated!
→ Plan ✔ Execution Plan Generated ✔ Secrets Stripped
→ Export ✘ Diagram Generation Failed node:internal/modules/package_json_reader:4 const internalModuleReadJSON = function (f) { return require('fs').internalModuleReadJSON(f); }; ^
TypeError: require(...).internalModuleReadJSON is not a function at internalModuleReadJSON (node:internal/modules/package_json_reader:4:68) at Object.read (node:internal/modules/package_json_reader:21:42) at readPackage (node:internal/modules/cjs/loader:296:36) at readPackageScope (node:internal/modules/cjs/loader:329:19) at trySelf (node:internal/modules/cjs/loader:444:40) at Function.Module._resolveFilename (node:internal/modules/cjs/loader:910:24) at Function.Module._load (node:internal/modules/cjs/loader:778:27) at Module.require (node:internal/modules/cjs/loader:1005:19) at Module._preloadModules (node:internal/modules/cjs/loader:1276:12) at loadPreloadModules (node:internal/bootstrap/pre_execution:489:5)
generating diagram failed -> RunGraph: running CLI command failed -> GenerateDiagram: exit status 1 ✘ Posting Run To Pluralith Dashboard Failed reading cache from disk failed -> HandleCIRun: open /home/ubuntu/..../aws_infrastructure/shared/.pluralith/pluralith.cache.json: no such file or directory