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

Error message isn't displayed when some ECS operations fail due to AccessDeniedException #2859

Closed
2 of 3 tasks
abicky opened this issue Oct 30, 2024 · 3 comments · Fixed by #2889
Closed
2 of 3 tasks
Assignees
Labels
bug This issue is a bug. p3 This is a minor priority issue service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@abicky
Copy link

abicky commented Oct 30, 2024

Acknowledgements

Describe the bug

No error message is displayed when some ECS operations depending on ecs.awsAwsjson11_deserializeErrorAccessDeniedException fail due to AccessDeniedException.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

An error message is displayed:

panic: operation error ECS: CreateService, https response error StatusCode: 400, RequestID: 4b95afb3-25ab-48dc-a2ba-1a9e4c0ecbda, AccessDeniedException: User: arn:aws:sts::xxxxxxxxx:assumed-role/xxxxxxxxxxx is not authorized to perform: ecs:CreateService on resource: arn:aws:ecs:ap-northeast-1:xxxxxxxxxxxxx:service/default/xxxxxxxx because no identity-based policy allows the ecs:CreateService action

goroutine 1 [running]:
main.main()
        example.com/test/main.go:23 +0x184

Current Behavior

No error message is displayed:

panic: operation error ECS: CreateService, https response error StatusCode: 400, RequestID: 2ed99e65-d0e9-463f-97c9-8b8cd34ffedf, AccessDeniedException:

goroutine 1 [running]:
main.main()
        example.com/test/main.go:23 +0x184

Reproduction Steps

  1. Prepare an IAM user or role that doesn't have the permission ecs:CreateService
  2. Run the following file with the user or role:
    • Note that you have to change the ARN of task definition.
package main

import (
	"context"

	"github.com/aws/aws-sdk-go-v2/aws"
	"github.com/aws/aws-sdk-go-v2/config"
	"github.com/aws/aws-sdk-go-v2/service/ecs"
)

func main() {
	cfg, err := config.LoadDefaultConfig(context.Background())
	if err != nil {
		panic(err)
	}

	client := ecs.NewFromConfig(cfg)
	_, err = client.CreateService(context.Background(), &ecs.CreateServiceInput{
		ServiceName: aws.String("xxxxx"),
		TaskDefinition: aws.String("arn:aws:ecs:ap-northeast-1:xxxxxxxxxx:task-definition/xxxxxx"),
	})
	if err != nil {
		panic(err)
	}
}

Possible Solution

The commit abicky@a8afd4a resolves the issue.
It includes the changes made by make all after I changed codegen/sdk-codegen/aws-models/ecs.json without the following unrelated change:

diff --git a/feature/dynamodbstreams/attributevalue/go_module_metadata.go b/feature/dynamodbstreams/attributevalue/go_module_metadata.go
index d2c5ca8ee0..04358c081d 100644
--- a/feature/dynamodbstreams/attributevalue/go_module_metadata.go
+++ b/feature/dynamodbstreams/attributevalue/go_module_metadata.go
@@ -3,4 +3,4 @@
 package attributevalue

 // goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.14.45"
+const goModuleVersion = "1.15.13"

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

module example.com/test

go 1.23.2

require (
	github.com/aws/aws-sdk-go-v2 v1.32.3
	github.com/aws/aws-sdk-go-v2/config v1.28.1
	github.com/aws/aws-sdk-go-v2/service/ecs v1.48.1
)

require (
	github.com/aws/aws-sdk-go-v2/credentials v1.17.42 // indirect
	github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.18 // indirect
	github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.22 // indirect
	github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.22 // indirect
	github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
	github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect
	github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.3 // indirect
	github.com/aws/aws-sdk-go-v2/service/sso v1.24.3 // indirect
	github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.3 // indirect
	github.com/aws/aws-sdk-go-v2/service/sts v1.32.3 // indirect
	github.com/aws/smithy-go v1.22.0 // indirect
	github.com/jmespath/go-jmespath v0.4.0 // indirect
)

Compiler and Version used

go version go1.23.2 darwin/arm64

Operating System and version

Darwin Takeshis-MacBook-Air.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:14:59 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8122 arm64

@abicky abicky added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 30, 2024
@abicky
Copy link
Author

abicky commented Oct 30, 2024

I've also created a PR #2860.

@RanVaknin
Copy link
Contributor

RanVaknin commented Oct 30, 2024

Hi @abicky ,

Thanks for taking the time to diagnose and raise a PR. Like I mentioned on my comment in the PR, we cannot accept changes to the model file since those are generated from an upstream source. Your changes would be overwritten with the next service release.

I have raised this internally with the ECS service team (ticket ID #P165892123). I cannot guarantee a timeline in which this is going to be fixed, but once I hear back I will update you.

Thanks,
Ran~

@RanVaknin RanVaknin added service-api This issue is due to a problem in a service API, not the SDK implementation. p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Oct 30, 2024
Copy link

github-actions bot commented Nov 7, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

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. p3 This is a minor priority issue service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
2 participants