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

SSM GetParameter is not resolving anymore after upgrading to aws-sdk-go-v2 v1.23.1 #2389

Closed
matthiasbruns opened this issue Nov 27, 2023 · 2 comments
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@matthiasbruns
Copy link

matthiasbruns commented Nov 27, 2023

Describe the bug

So after updating my AWS SDK dependencies to the following, for some reason SSM.GetParameter is not working anymore

Dependencies new:

	github.com/aws/aws-sdk-go-v2 v1.23.1
	github.com/aws/aws-sdk-go-v2/config v1.23.0
	github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.3
	github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.3
	github.com/aws/aws-sdk-go-v2/service/sqs v1.28.0
	github.com/aws/aws-sdk-go-v2/service/ssm v1.42.1

Dependencies old:

	github.com/aws/aws-sdk-go-v2 v1.22.2
	github.com/aws/aws-sdk-go-v2/config v1.23.0
	github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.1
	github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.1
	github.com/aws/aws-sdk-go-v2/service/sqs v1.28.0
	github.com/aws/aws-sdk-go-v2/service/ssm v1.42.1

Expected Behavior

ssmValue, err := ssmClient.GetParameter(ctx, &ssm.GetParameterInput{
	Name:           aws.String(" " + envValue),
	WithDecryption: aws.Bool(true),
})

if err != nil {
	log.Fatalf("unable to get \"%s\", with error: %v", envValue, err)
}

should work for existing ssm params, when account has access to them.

Current Behavior

2023/11/27 12:15:44 unable to get NAME, with error: not found, ResolveEndpointV2

where NAME is the full name of an SSM param, e.g /my/best/ssm/ever with SecureString set as type

Reproduction Steps

// credentials must be in env - locally I use AWS_PROFILE with AWS_REGION, and in AWS, I use the lambda env
func main(){
	ctx := context.Background()
	cfg, err := config.LoadDefaultConfig(ctx)
	if err != nil {
		log.Fatalf("unable to load SDK config, %v", err)
	}
	ssmClient := ssm.NewFromConfig(cfg)
	
	ssmValue, err := ssmClient.GetParameter(ctx, &ssm.GetParameterInput{
		Name:           aws.String("/my/best/ssm/ever"),
		WithDecryption: aws.Bool(true),
	})

	if err != nil {
		log.Fatalf("unable to get \"%s\", with error: %v", envValue, err)
	}

	// expecting to have a valid ssmValue at this point, but `err != nil`

Using the AWS CLI with the same profile locally or in the AWS account returns a valid SSMParameter with the requested name.

Possible Solution

I had to downgrade back to

	github.com/aws/aws-lambda-go v1.41.0
	github.com/aws/aws-sdk-go-v2 v1.22.2
	github.com/aws/aws-sdk-go-v2/config v1.23.0
	github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.1
	github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.1
	github.com/aws/aws-sdk-go-v2/service/sqs v1.28.0
	github.com/aws/aws-sdk-go-v2/service/ssm v1.42.1

Additional Information/Context

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2 v1.23.1
github.com/aws/aws-sdk-go-v2/config v1.23.0
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.3
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.3
github.com/aws/aws-sdk-go-v2/service/sqs v1.28.0
github.com/aws/aws-sdk-go-v2/service/ssm v1.42.1

Compiler and Version used

go1.21.3

Operating System and version

darwin/arm64

@matthiasbruns matthiasbruns added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 27, 2023
@lucix-aws
Copy link
Contributor

see #2370

@lucix-aws lucix-aws closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2023
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants