aws / aws-sdk-go-v2

AWS SDK for the Go programming language.
https://aws.github.io/aws-sdk-go-v2/docs/
Apache License 2.0
2.5k stars 602 forks source link

Unable to use apigatewaymanagementapi using sdk v2 1.19.11 #2687

Closed zxl199409 closed 1 week ago

zxl199409 commented 2 weeks ago

Acknowledgements

Describe the bug

InvalidSignatureException: Credential should be scoped to correct service: 'execute-api'.

Expected Behavior

I don’t know why it is incompatible after the upgrade

Current Behavior

impact test

Reproduction Steps

1

Possible Solution

No response

Additional Information/Context

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

    pushClient = apigatewaymanagementapi.NewFromConfig(cfg, func(o *apigatewaymanagementapi.Options) {
        o.EndpointResolver = apigatewaymanagementapi.EndpointResolverFromURL(imConfig.EnvVar.ApiGatewayEndpoint)
        o.HTTPClient = &http.Client{Transport: service.DefaultHTTPTransport()}
    })
}

    _, err := pushClient.PostToConnection(ctx, &apigatewaymanagementapi.PostToConnectionInput{
        ConnectionId: &connectionId,
        Data:         data,
    })

error!!! PostToConnection error: operation error ApiGatewayManagementApi: PostToConnection, https response error StatusCode: 403, RequestID: 5192a476-9b9c-46f4-8e1d-aed5e7492917, api error InvalidSignatureException: Credential should be scoped to correct service: 'execute-api'.

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2/service/apigatewaymanagementapi v1.19.11

Compiler and Version used

go 1.19

Operating System and version

arm64

RanVaknin commented 2 weeks ago

Hi @zxl199409,

You mentioned "incompatible after the upgrade" does downgrading the SDK version resolve this issue for you?

Additionally, It's hard to tell what might be going wrong since you are providing your own custom HTTP transport and your own endpoint resolver. Can you share these configurations with us?

Thanks, Ran~

github-actions[bot] commented 1 week ago

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.