aws-cloudformation / rain

A development workflow tool for working with AWS CloudFormation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: unable to find valid credentials

chrisgrounds opened this issue · comments

OS: Windows

Problem
When running any of the following:

  • .\rain.exe ls --debug
  • .\rain.exe ls -p <profile_name> --debug
  • <set AWS_PROFILE here>; .\rain.exe ls --debug

I'm having the following error:

panic: unable to find valid credentials [recovered]
        panic: unable to find valid credentials

goroutine 1 [running]:
github.com/aws-cloudformation/rain/internal/cmd.execute.func1()
        /__w/rain/rain/internal/cmd/wrap.go:77 +0x15e
panic({0xe4d720?, 0xc000904a90?})
        /usr/local/go/src/runtime/panic.go:914 +0x21f
github.com/aws-cloudformation/rain/internal/aws.loadConfig({0x29c7160?, 0xf50bdb?}, {0xc0008d7970, 0xb})
        /__w/rain/rain/internal/aws/aws.go:80 +0x859
github.com/aws-cloudformation/rain/internal/aws.NamedConfig({_, _})
        /__w/rain/rain/internal/aws/aws.go:118 +0x22c
github.com/aws-cloudformation/rain/internal/aws.Config(...)
        /__w/rain/rain/internal/aws/aws.go:99
github.com/aws-cloudformation/rain/internal/cmd/ls.glob..func1(0xc00047b000?, {0xc0009152c0?, 0x4?, 0xf21b23?})
        /__w/rain/rain/internal/cmd/ls/ls.go:44 +0x25d
github.com/spf13/cobra.(*Command).execute(0x296b960, {0xc000915260, 0x3, 0x3})
        /go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xaa3
github.com/spf13/cobra.(*Command).ExecuteC(0x2969400)
        /go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/aws-cloudformation/rain/internal/cmd.execute(0xc000102058?)
        /__w/rain/rain/internal/cmd/wrap.go:86 +0x57
github.com/aws-cloudformation/rain/internal/cmd.Execute(0xc000064000?)
        /__w/rain/rain/internal/cmd/wrap.go:95 +0x13
main.main()
        /__w/rain/rain/cmd/rain/main.go:23 +0x1a

Config
My aws credentials file:

[profile1]
aws_access_key_id=<access_key>
aws_secret_access_key=<secret_key>

[role]
role_arn=arn:aws:iam::<account>:role/<role_name>
source_profile=profile1

and my config file contains both profiles with the region set.

Further notes:

  • I've tried both setting profile1 and role as the profile in the command.
  • I've also tried explicitly setting the path to the config and credentials files in the shell.
  • Other AWS services such as CDK work with these credentials, so it can't be a PATH issue since CDK can find the aws config and credentials files in the same shell instance.

Same issue with rain-v1.7.4_darwin-arm64.

aws-sdk-go-v2 was bumped from v1.22.2 to v1.24.0 in 1.7.4 (v1.7.3...v1.7.4#diff-33ef32bf6c23acb95f5902d7097b7a1d5128ca061167ec0716715b0b9eeaa5f6R8)

This seems relevant... aws/aws-sdk-go-v2#2370 but I don't have time to look any further and am rolling back to 1.7.3 which works.

I just released 1.7.5, which addresses recent breaking changes in the Go AWS SDK. Once that is available, try and see if the issue persists.

Issue resolved with 1.7.5 for me. Thanks!