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

immediate panic after selecting a provider #45

Open
zswanson opened this issue Dec 1, 2023 · 2 comments
Open

immediate panic after selecting a provider #45

zswanson opened this issue Dec 1, 2023 · 2 comments

Comments

@zswanson
Copy link

zswanson commented Dec 1, 2023

Installed with brew, version 0.1.4
First time run, select either provider from the text menu. Immediate go panic and crash. Running on Mac M1, Monterey.
A colleague has the same issue on an Ubuntu VM running on Windows.

14:36:19 ❯ cloudlens
panic: runtime error: index out of range [0] with length 0 [recovered]
	panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/derailed/tview.(*Application).Run.func1()
	github.com/derailed/[email protected]/application.go:243 +0x50
panic({0x101dc8c20, 0x14000198390})
	runtime/panic.go:884 +0x204
github.com/one2nc/cloudlens/internal/view.(*App).handleGCP(0x14000c099a0)
	github.com/one2nc/cloudlens/internal/view/app.go:187 +0x648
github.com/one2nc/cloudlens/internal/view.(*App).handleCloudSelection(0x14000c099a0, {0x101518676?, 0x0?})
	github.com/one2nc/cloudlens/internal/view/app.go:227 +0x9c
github.com/one2nc/cloudlens/internal/view.(*App).showCloudSelectionScreen.func2()
	github.com/one2nc/cloudlens/internal/view/app.go:213 +0x2c
github.com/derailed/tview.(*List).InputHandler.func1(0x14000c7a400?, 0x14000794050?)
	github.com/derailed/[email protected]/list.go:582 +0xa8
github.com/derailed/tview.(*Box).WrapInputHandler.func1(0x140005e8480?, 0xd4ee60?)
	github.com/derailed/[email protected]/box.go:182 +0x54
github.com/derailed/tview.(*Flex).InputHandler.func1(0x14000c7a200?, 0x14000794040?)
	github.com/derailed/[email protected]/flex.go:261 +0xd4
github.com/derailed/tview.(*Box).WrapInputHandler.func1(0x14000c2aae0?, 0x1008ca2ec?)
	github.com/derailed/[email protected]/box.go:182 +0x54
github.com/derailed/tview.(*Flex).InputHandler.func1(0x140001c1f00?, 0x14000794030?)
	github.com/derailed/[email protected]/flex.go:261 +0xd4
github.com/derailed/tview.(*Box).WrapInputHandler.func1(0x14000c2a990?, 0x10ac87cc8?)
	github.com/derailed/[email protected]/box.go:182 +0x54
github.com/derailed/tview.(*Pages).InputHandler.func1(0x10?, 0x101c9a6c0?)
	github.com/derailed/[email protected]/pages.go:332 +0xa8
github.com/derailed/tview.(*Box).WrapInputHandler.func1(0x14000c2a330?, 0x14000d7fb60?)
	github.com/derailed/[email protected]/box.go:182 +0x54
github.com/derailed/tview.(*Application).Run(0x140000341c0)
	github.com/derailed/[email protected]/application.go:334 +0x70c
github.com/one2nc/cloudlens/internal/view.(*App).Run(0x14000c099a0)
	github.com/one2nc/cloudlens/internal/view/app.go:296 +0x80
github.com/one2nc/cloudlens/cmd.initView()
	github.com/one2nc/cloudlens/cmd/root.go:57 +0xd0
github.com/one2nc/cloudlens/cmd.run(0x102d9bbe0?, {0x10151bcb2?, 0x0?, 0x0?})
	github.com/one2nc/cloudlens/cmd/root.go:51 +0x1c
github.com/spf13/cobra.(*Command).execute(0x102d9bbe0, {0x140001901d0, 0x0, 0x0})
	github.com/spf13/[email protected]/command.go:920 +0x5b0
github.com/spf13/cobra.(*Command).ExecuteC(0x102d9bbe0)
	github.com/spf13/[email protected]/command.go:1044 +0x35c
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/[email protected]/command.go:968
github.com/one2nc/cloudlens/cmd.Execute()
	github.com/one2nc/cloudlens/cmd/root.go:44 +0x58
main.main()
	github.com/one2nc/cloudlens/main.go:8 +0x1c
@zswanson zswanson changed the title immediate panic when using GCP immediate panic after selecting a provider Dec 1, 2023
@RamanaReddy0M
Copy link
Collaborator

RamanaReddy0M commented Dec 27, 2023

@zswanson, Prior to choosing the provider (AWS/GCP), the application requires the configuration of GOOGLE_APPLICATION_CREDENTIALS for GCP or the presence of a ~/.aws/credentials file for AWS.

Failure to locate the GOOGLE_APPLICATION_CREDENTIALS file or the ~/.aws/credentials file could potentially trigger a panic within the application.

Note: You can also use cloudlens gcp --cf <creds-file> command for GCP.

@rupurt
Copy link

rupurt commented Aug 12, 2024

Hi @RamanaReddy0M,

I'm also getting the same error after setting the GCP credentials. It looks like it's due to not having permissions to fetch zones https://github.com/one2nc/cloudlens/blob/main/internal/view/app.go#L178C20-L178C30

10:15AM DBG Failed to list zones: Get "https://compute.googleapis.com/compute/v1/projects/my-project/zones?alt=json&prettyPrint=false": oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"Invalid JWT Signature."}

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

3 participants