Giter Club home page Giter Club logo

Comments (10)

arjunmahishi avatar arjunmahishi commented on August 31, 2024 5

I think this is the problem:

isExp := sess.Config.Credentials.IsExpired()
if err != nil {
fmt.Println("Error creating session:", err)
return nil, err
}
if isExp {
fmt.Println("Credentials have expired")
return nil, errors.New("AWS Credentials expired")
}

IsExpired might not be relevant for all types of authentications. I am using access_token + secret_token, and commenting out this check worked for me.

If you ask me, this check can probably be skipped altogether. Unless the tool is refreshing the token on expiry or taking some other action. If it's expired, just let the operations fail with whatever error the AWS SDK throws.

from cloudlens.

sagarrakshe avatar sagarrakshe commented on August 31, 2024 4

@chinmay185
Oh! I forgot to mention. My credentials have not expired, I use them daily. Yet I am getting this error.

from cloudlens.

chinmay185 avatar chinmay185 commented on August 31, 2024 1

#4 fixes this.

from cloudlens.

chinmay185 avatar chinmay185 commented on August 31, 2024

Thanks for the details @sagarrakshe. We recently changed this behaviour, but on second thoughts, I think we should launch the app, even if the credentials are expired/invalid/not found (instead of panicing).

In the app, we can show a flash message indicating to fix the credentials. We'll fix this soon.

from cloudlens.

dirien avatar dirien commented on August 31, 2024

Same for me: I use aws with sso and get all the time this error message. I do a aws sso login before starting cloudlens

cloudlens
Profile 'default' not found, using profile 'private'... Credentials have expired
panic: aws session init failed -- AWS Credentials expired

goroutine 1 [running]:
github.com/one2nc/cloudlens/cmd.run(0x10140dd00?, {0x100966704?, 0x0?, 0x0?})
	github.com/one2nc/cloudlens/cmd/root.go:73 +0x4c8
github.com/spf13/cobra.(*Command).execute(0x10140dd00, {0x14000118200, 0x0, 0x0})
	github.com/spf13/[email protected]/command.go:920 +0x5b0
github.com/spf13/cobra.(*Command).ExecuteC(0x10140dd00)
	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:42 +0x28
main.main()
	github.com/one2nc/cloudlens/main.go:8 +0x1c

from cloudlens.

seh avatar seh commented on August 31, 2024

Like @dirien's report in #1 (comment), I use aws-vault as my credential process, with profiles using SSO.

from cloudlens.

WMRamadan avatar WMRamadan commented on August 31, 2024

I use MFA with my AWS login and before I login with MFA I would get the following error:

Credentials have expired
panic: aws session init failed -- AWS Credentials expired

After I login with MFA I get the following error:

failed to load AWS SDK config: assume role with MFA enabled, but AssumeRoleTokenProvider session option not set.

from cloudlens.

ahuffman avatar ahuffman commented on August 31, 2024

similar, but I'm using aws access key is and aws secret access key. AWS CLI works fine, but I get this from cloudlens:

cloudlens
Credentials have expired
panic: aws session init failed -- AWS Credentials expired

goroutine 1 [running]:
github.com/one2nc/cloudlens/cmd.run(0x22f2d20?, {0x1a272af?, 0x0?, 0x0?})
	github.com/one2nc/cloudlens/cmd/root.go:73 +0x4ce
github.com/spf13/cobra.(*Command).execute(0x22f2d20, {0xc00010a200, 0x0, 0x0})
	github.com/spf13/[email protected]/command.go:920 +0x847
github.com/spf13/cobra.(*Command).ExecuteC(0x22f2d20)
	github.com/spf13/[email protected]/command.go:1044 +0x3bd
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:42 +0x25
main.main()
	github.com/one2nc/cloudlens/main.go:8 +0x17

from cloudlens.

golgotow avatar golgotow commented on August 31, 2024

Hi,

installed on Linux mint and getting error like below

cloudlens 
Credentials have expired
panic: aws session init failed -- AWS Credentials expired

goroutine 1 [running]:
github.com/one2nc/cloudlens/cmd.run(0x16ede00?, {0xe25ef7?, 0x0?, 0x0?})
	github.com/one2nc/cloudlens/cmd/root.go:73 +0x4ce
github.com/spf13/cobra.(*Command).execute(0x16ede00, {0xc000034240, 0x0, 0x0})
	github.com/spf13/[email protected]/command.go:920 +0x847
github.com/spf13/cobra.(*Command).ExecuteC(0x16ede00)
	github.com/spf13/[email protected]/command.go:1044 +0x3bd
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:42 +0x25
main.main()
	github.com/one2nc/cloudlens/main.go:8 +0x17

aws command normally work fine for me

Br,

from cloudlens.

marcusschiesser avatar marcusschiesser commented on August 31, 2024

I run into the same issue using aws-mfa with --assume-role to authenticate with AWS. I tested with v0.1.0.

Here's the output:

Credentials have expired
panic: aws session init failed -- AWS Credentials expired

goroutine 1 [running]:
github.com/one2nc/cloudlens/cmd.run(0x123dda0?, {0x970b5a?, 0x0?, 0x0?})
        github.com/one2nc/cloudlens/cmd/root.go:73 +0x4d0
github.com/spf13/cobra.(*Command).execute(0x123dda0, {0x400009e220, 0x0, 0x0})
        github.com/spf13/[email protected]/command.go:920 +0x5c8
github.com/spf13/cobra.(*Command).ExecuteC(0x123dda0)
        github.com/spf13/[email protected]/command.go:1044 +0x368
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:42 +0x28
main.main()
        github.com/one2nc/cloudlens/main.go:8 +0x1c

from cloudlens.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.