Erroneous error on sam local invoke running aws-sam-cli version 1.15.0 on Mac OS Big Sur (11.1). Every invoke produces the same error. If I run aws-sam-cli version 1.12.0 I do not get the following error message.
The security token included in the request is invalid
Mac OS Big Sur (11.1)
sam version 1.15.0
sam local invoke [FunctionName]
require 'aws-sdk-dynamodb'
def lambda_handler(event:, context:)
dynamodb = Aws::DynamoDB::Client.new()
resp = dynamodb.list_tables()
p resp['table_names']
end
2020-12-30 13:18:38,776 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2020-12-30 13:18:38,777 | local invoke command is called
2020-12-30 13:18:38,824 | No Parameters detected in the template
2020-12-30 13:18:38,862 | 15 resources found in the template
2020-12-30 13:18:38,862 | Found Serverless function with name='GetCampsiteProfileFunction' and CodeUri='campers/'
2020-12-30 13:18:38,862 | Found Serverless function with name='PopulateUserFunction' and CodeUri='campers/'
2020-12-30 13:18:38,862 | Found Serverless function with name='EmbedDomainsPipelineFunction' and CodeUri='campers/'
2020-12-30 13:18:38,863 | Found Serverless function with name='GetCamperLinksFunction' and CodeUri='campers/'
2020-12-30 13:18:38,863 | Found Serverless function with name='PutCamperLinksFunction' and CodeUri='campers/'
2020-12-30 13:18:38,863 | Found Serverless function with name='GetOgMetadataFunction' and CodeUri='paint/'
2020-12-30 13:18:38,863 | Found Serverless function with name='GetTablesFunction' and CodeUri='paint/'
2020-12-30 13:18:38,863 | Found Serverless function with name='PainterFunction' and CodeUri='paint/'
2020-12-30 13:18:38,863 | Found Serverless function with name='GoogleAnalyticsFunction' and CodeUri='apis/'
2020-12-30 13:18:38,863 | Found Serverless function with name='intercomFunction' and CodeUri='apis/'
2020-12-30 13:18:38,863 | Found Serverless function with name='PuppeteerFunction' and CodeUri='puppeteer/'
2020-12-30 13:18:38,863 | Found Serverless function with name='FeaturesReportFunction' and CodeUri='reports/'
2020-12-30 13:18:38,863 | Found Serverless function with name='WallpaperGeneratorFunction' and CodeUri='wallpaper/'
2020-12-30 13:18:38,871 | Found one Lambda function with name 'GetTablesFunction'
2020-12-30 13:18:38,871 | Invoking table_names.lambda_handler (ruby2.5)
2020-12-30 13:18:38,872 | No environment variables found for function 'GetTablesFunction'
2020-12-30 13:18:38,872 | Environment variables overrides data is standard format
2020-12-30 13:18:38,872 | Loading AWS credentials from session with profile 'None'
2020-12-30 13:18:38,882 | Resolving code path. Cwd=/Users/josh/Documents/repos/Summer-Camp, CodeUri=paint/
2020-12-30 13:18:38,882 | Resolved absolute path to code is /Users/josh/Documents/repos/Summer-Camp/paint
2020-12-30 13:18:38,883 | Code /Users/josh/Documents/repos/Summer-Camp/paint is not a zip/jar file
2020-12-30 13:18:38,904 | Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-ruby2.5:rapid-1.15.0.
2020-12-30 13:18:38,904 | Mounting /Users/josh/Documents/repos/Summer-Camp/paint as /var/task:ro,delegated inside runtime container
2020-12-30 13:18:39,327 | Starting a timer for 30 seconds for function 'GetTablesFunction'
START RequestId: fa5300d3-15d0-4de0-8b4b-88a6145dee5e Version: $LATEST
Error raised from handler method
{
"errorMessage": "The security token included in the request is invalid",
"errorType": "Function<Aws::DynamoDB::Errors::UnrecognizedClientException>",
"stackTrace": [
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/seahorse/client/plugins/raise_response_errors.rb:17:in `call'",
"/var/runtime/gems/aws-sdk-dynamodb-1.58.0/lib/aws-sdk-dynamodb/plugins/simple_attributes.rb:119:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:22:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/aws-sdk-core/plugins/idempotency_token.rb:19:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/aws-sdk-core/plugins/param_converter.rb:26:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/seahorse/client/plugins/request_callback.rb:71:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/aws-sdk-core/plugins/response_paging.rb:12:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/seahorse/client/plugins/response_target.rb:24:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/seahorse/client/request.rb:72:in `send_request'",
"/var/runtime/gems/aws-sdk-dynamodb-1.58.0/lib/aws-sdk-dynamodb/client.rb:3602:in `list_tables'",
"/var/task/table_names.rb:8:in `lambda_handler'"
]
}
END RequestId: fa5300d3-15d0-4de0-8b4b-88a6145dee5e
REPORT RequestId: fa5300d3-15d0-4de0-8b4b-88a6145dee5e Init Duration: 0.63 ms Duration: 1180.16 ms Billed Duration: 1200 ms Memory Size: 128 MBMax Memory Used: 128 MB
2020-12-30 13:21:33,312 | Telemetry endpoint configured to be https://aws-serverless-tools-telemetry.us-west-2.amazonaws.com/metrics
2020-12-30 13:21:33,406 | local invoke command is called
2020-12-30 13:21:33,440 | No Parameters detected in the template
2020-12-30 13:21:33,473 | 15 resources found in the template
2020-12-30 13:21:33,473 | Found Serverless function with name='GetCampsiteProfileFunction' and CodeUri='campers/'
2020-12-30 13:21:33,473 | Found Serverless function with name='PopulateUserFunction' and CodeUri='campers/'
2020-12-30 13:21:33,473 | Found Serverless function with name='EmbedDomainsPipelineFunction' and CodeUri='campers/'
2020-12-30 13:21:33,473 | Found Serverless function with name='GetCamperLinksFunction' and CodeUri='campers/'
2020-12-30 13:21:33,473 | Found Serverless function with name='PutCamperLinksFunction' and CodeUri='campers/'
2020-12-30 13:21:33,473 | Found Serverless function with name='GetOgMetadataFunction' and CodeUri='paint/'
2020-12-30 13:21:33,473 | Found Serverless function with name='GetTablesFunction' and CodeUri='paint/'
2020-12-30 13:21:33,473 | Found Serverless function with name='PainterFunction' and CodeUri='paint/'
2020-12-30 13:21:33,473 | Found Serverless function with name='GoogleAnalyticsFunction' and CodeUri='apis/'
2020-12-30 13:21:33,473 | Found Serverless function with name='intercomFunction' and CodeUri='apis/'
2020-12-30 13:21:33,474 | Found Serverless function with name='PuppeteerFunction' and CodeUri='puppeteer/'
2020-12-30 13:21:33,474 | Found Serverless function with name='FeaturesReportFunction' and CodeUri='reports/'
2020-12-30 13:21:33,474 | Found Serverless function with name='WallpaperGeneratorFunction' and CodeUri='wallpaper/'
2020-12-30 13:21:33,491 | Found one Lambda function with name 'GetTablesFunction'
2020-12-30 13:21:33,492 | Invoking table_names.lambda_handler (ruby2.5)
2020-12-30 13:21:33,492 | No environment variables found for function 'GetTablesFunction'
2020-12-30 13:21:33,492 | Environment variables overrides data is standard format
2020-12-30 13:21:33,492 | Loading AWS credentials from session with profile 'None'
2020-12-30 13:21:33,503 | Resolving code path. Cwd=/Users/josh/Documents/repos/Summer-Camp, CodeUri=paint/
2020-12-30 13:21:33,503 | Resolved absolute path to code is /Users/josh/Documents/repos/Summer-Camp/paint
2020-12-30 13:21:33,503 | Code /Users/josh/Documents/repos/Summer-Camp/paint is not a zip/jar file
2020-12-30 13:21:33,516 | Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-ruby2.5:rapid-1.12.0.
2020-12-30 13:21:33,517 | Mounting /Users/josh/Documents/repos/Summer-Camp/paint as /var/task:ro,delegated inside runtime container
2020-12-30 13:21:33,867 | Starting a timer for 30 seconds for function 'GetTablesFunction'
START RequestId: 38cff02c-ab65-1710-0145-ca8e0692bed2 Version: $LATEST
["cash"]
END RequestId: 38cff02c-ab65-1710-0145-ca8e0692bed2
REPORT RequestId: 38cff02c-ab65-1710-0145-ca8e0692bed2 Init Duration: 675.20 ms Duration: 464.97 ms Billed Duration: 500 ms Memory Size: 128 MBMax Memory Used: 38 MB
Mac
sam --version: 1.15.0Hello are you there
I was not able to reproduce this issue.
The following steps executed successfully:
% sam init
Which template source would you like to use?
1 - AWS Quick Start Templates
2 - Custom Template Location
Choice: 1
What package type would you like to use?
1 - Zip (artifact is a zip uploaded to S3)
2 - Image (artifact is an image uploaded to an ECR image repository)
Package type: 1
Which runtime would you like to use?
1 - nodejs12.x
2 - python3.8
3 - ruby2.7
4 - go1.x
5 - java11
6 - dotnetcore3.1
7 - nodejs10.x
8 - python3.7
9 - python3.6
10 - python2.7
11 - ruby2.5
12 - java8.al2
13 - java8
14 - dotnetcore2.1
Runtime: 3
Project name [sam-app]: test-ruby-ddb
Cloning app templates from https://github.com/aws/aws-sam-cli-app-templates
AWS quick start application templates:
1 - Hello World Example
2 - Step Functions Sample App (Stock Trader)
Template selection: 1
-----------------------
Generating application:
-----------------------
Name: test-ruby-ddb
Runtime: ruby2.7
Dependency Manager: bundler
Application Template: hello-world
Output Directory: .
Next steps can be found in the README file at ./test-ruby-ddb/README.md
% cd test-ruby-ddb/
% vim hello_world/app.rb
require 'aws-sdk-dynamodb'
def lambda_handler(event:, context:)
dynamodb = Aws::DynamoDB::Client.new()
resp = dynamodb.list_tables()
p resp['table_names']
end
% aws configure
AWS Access Key ID [********************]:
AWS Secret Access Key [********************]:
Default region name [us-west-2]:
Default output format [None]:
% sam local invoke
Invoking app.lambda_handler (ruby2.7)
Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-ruby2.7:rapid-1.15.0.
Mounting /Volumes/Unix/workplace/github-issues/test-ruby-ddb/hello_world as /var/task:ro,delegated inside runtime container
START RequestId: 9d6e4531-99ec-4dab-8753-b0bd5880c897 Version: $LATEST
["sam-app-web-SampleTable-1KVY7XSLH20QA", "test-SampleTable-1QMILHHZIHJOU"]
END RequestId: 9d6e4531-99ec-4dab-8753-b0bd5880c897
REPORT RequestId: 9d6e4531-99ec-4dab-8753-b0bd5880c897 Init Duration: 0.32 ms Duration: 1220.20 ms Billed Duration: 1300 ms Memory Size: 128 MB Max Memory Used: 128 MB
["sam-app-web-SampleTable-1KVY7XSLH20QA","test-SampleTable-1QMILHHZIHJOU"]%
Could you please retry again, and do not forget to update the AWS profile (name it default, or you need to add --profile
I did set --profile to default in one of my troubleshooting iterations Here is the debug output:
$ sam --version
SAM CLI, version 1.15.0
$ aws configure
AWS Access Key ID [****************]:
AWS Secret Access Key [****************]:
Default region name [us-west-2]:
Default output format [json]:
$ sam local invoke GetTablesFunction --debug --profile default
local invoke command is called
No Parameters detected in the template
15 resources found in the template
...
Found one Lambda function with name 'GetTablesFunction'
Invoking table_names.lambda_handler (ruby2.5)
No environment variables found for function 'GetTablesFunction'
Environment variables overrides data is standard format
Loading AWS credentials from session with profile 'default'
...
Code /Users/josh/Documents/repos/Summer-Camp/paint is not a zip/jar file
Skip pulling image and use local one: amazon/aws-sam-cli-emulation-image-ruby2.5:rapid-1.15.0.
Mounting /Users/josh/Documents/repos/Summer-Camp/paint as /var/task:ro,delegated inside runtime container
Starting a timer for 30 seconds for function 'GetTablesFunction'
START RequestId: ca33d009-de68-4b1a-9d9a-55129fed2fa8 Version: $LATEST
Error raised from handler method
{
"errorMessage": "The security token included in the request is invalid",
"errorType": "Function<Aws::DynamoDB::Errors::UnrecognizedClientException>",
"stackTrace": [
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/seahorse/client/plugins/raise_response_errors.rb:17:in `call'",
"/var/runtime/gems/aws-sdk-dynamodb-1.58.0/lib/aws-sdk-dynamodb/plugins/simple_attributes.rb:119:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:22:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/aws-sdk-core/plugins/idempotency_token.rb:19:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/aws-sdk-core/plugins/param_converter.rb:26:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/seahorse/client/plugins/request_callback.rb:71:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/aws-sdk-core/plugins/response_paging.rb:12:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/seahorse/client/plugins/response_target.rb:24:in `call'",
"/var/runtime/gems/aws-sdk-core-3.110.0/lib/seahorse/client/request.rb:72:in `send_request'",
"/var/runtime/gems/aws-sdk-dynamodb-1.58.0/lib/aws-sdk-dynamodb/client.rb:3602:in `list_tables'",
"/var/task/table_names.rb:5:in `lambda_handler'"
]
}
END RequestId: ca33d009-de68-4b1a-9d9a-55129fed2fa8
REPORT RequestId: ca33d009-de68-4b1a-9d9a-55129fed2fa8 Init Duration: 0.87 ms Duration: 1293.50 ms Billed Duration: 1300 ms Memory Size: 128 MB Max Memory Used: 128 MB
To confirm I am on Big Sur 11.1 OS, also I picked ruby 2.5 so runtime (11), not sure that would make a difference. What version of Docker are you on? I am on version 3.0.3 (51017)
Thanks!
I tested it again using ruby 2.5, and it worked fine.
my environment is:
MacOs Catalina 10.15
Docker version 20.10.0, build 7287ab3
SAM CLI, version 1.15.0
I will see if I can check it on MacOs Big Sur 11.1
meanwhile can I ask you to update the docker, and try again.
I was giving the docker desktop version before, my bad.
docker -v
Docker version 20.10.0, build 7287ab3
thanks @joshwerner .. I am able to reproduce the issue.