Skip to content

Question about Request to Lambda function with ARN #146

Closed
@dbbgb

Description

@dbbgb

Hi,
I have a question on call lambda functions. In documents says that as the name of the function can be used ARN.
If I try to use ARN instead of the function name in this example:

...
Aws::Lambda::Model::InvokeRequest request;
request.SetInvocationType(InvocationType::RequestResponse);
Aws::Lambda::Model::InvokeResult result;
//request.SetFunctionName("fn_v3"); // It works
request.SetFunctionName("arn:aws:lambda:us-west-2:XXXXXXXXXX:function:fn_v3");  // This does not work
auto payload = Aws::MakeShared<Aws::StringStream>("invokeLambda");
*payload << AWS_TEST_BODY;
request.SetBody(payload);
auto response = lambdaClient.Invoke(request);
...

I get the error:

Error: Unable to parse ExceptionName: InvalidSignatureException:http://internal.
amazon.com/coral/com.amazon.coral.service/ Message: The request signature we cal
culated does not match the signature you provided. Check your AWS Secret Access
Key and signing method. Consult the service documentation for details.

The Canonical String for this request should have been
'POST /2015-03-31/functions/arn%253Aaws%253Alambda%253Aus-west-2%253AXXXXXXXXX%253A
function%253Afn_v3/invocations
...

If I use the function name, the code works.

Help please understand what the problem is.
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions