-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
sam local start-api invoke lambda unable to access DynamoDB, the error message showed "The security token included in the request is invalid ". #2143
Comments
Same here |
Hi @leo731121 , Thanks for raising this up. Is it possible to test the issue with v0.53.0 of SAM CLI? |
Hi @mndeveci , |
I have replicated the issue in windows 10 which installed sam local v1.0.0. It seems not to be a problem cause by OS. I got an old version from the link(https://github.com/awslabs/aws-sam-cli/releases) and then installed v0.49.0 (AWS_SAM_CLI_64_PY3.msi)in Windows 10. The issue (security token invalid) will not occur. When using v0.49.0, the sam local will download image lambci/lambda. If I use sam local v1.0.0, the image file will be amazon/aws-sam-cli-emulation-image-java8:rapid-1.0.0. Is there any way to install older sam local with tar.gz file ? |
Hi, @mndeveci git clone https://github.com/awslabs/aws-sam-cli I think the major issue is docker image. v0.53.0 will fetch lambci/lambda:java8 docker image . Instead v1.0.0 will fetch amazon/aws-sam-cli-emulation-image-java8 rapid-1.0.0. |
I confirm this problem on MacBook using aws sam v1.1.0 |
This wasted 3 days of my time debugging (I am on Windows 10 WSL1). I can attach to the running docker image and execute my lambda (Go runtime) directly and code I've put into the main function that accesses DynamoDB will work. However when run with /var/rapid/init that same lambda executable fails. Something in either the init or the bootstrap has changed and is somehow breaking the security context. Printing out my session credentials shows that they are correct independently of how the code is run (directly or through init). This is also not specific to DynamoDB as I originally ran into this trying to communicate with Cognito. I suspect talking to all AWS services is broken although I have only tested these two. |
I got same error with SecretManager and AWS CLI 1.1.0 from upgrading from older version |
anyone knows how I can downgrade or install another older version of aws sam cli with brew? |
We tracked down the issue and it is only happening in java8 images. java11 or new java8.al2 images doesn't have this bug. About downgrading the SAM CLI, I tried to follow couple of brew documents, but I wasn't able to install specific version. |
thanks, with java11 manage to test aws tool kit and debug works now. I can use this until is fixed. |
@mndeveci I tried python3.6 image, seems same issue occur. I can get worked by hardcode credentials in boto3 API, but failed if using |
@zhouziyang can you write down the steps to reproduce the issue? |
Can we please update the issue description? This is not a specific problem with DynamoDB, but a generic key ingestion problem on the SAM container. |
hi, @mndeveci, I used git to checkout tags/v0.53.0 and used python to downgrade sam local.
I wasn't able to install specific version via brew ,either. |
hi, @mndeveci, |
hi, @Ghilteras , It would be thankful if you could update the description. |
@mndeveci Hi, sorry for late reply. I'm running with command |
I am also experiencing this issue with a Go Lambda that downloads files from S3. |
This is now fixed. You do not need to upgrade the AWS SAM CLI to see the changes reflected, but you may need to delete your older images. This impacted:
If you clean up the associated Docker images and rerun |
@awood45 how this has been fixed? without doing a new aws sam cli version? |
The Docker images themselves have been updated, which all versions from |
I am still getting this issue on SAM CLI, version 1.23.0. I have tried uninstalling and reinstalling the sam cli, but with no success. any suggestions? |
Any update on this |
Also seeing this. Running sam cli v1.46.0 with nodejs v14 runtime (image is nodejs14.x-x86_64-f88a901bbe51b578e9260ae49). |
cli v 1.50.0 with image runtime getting the same error accessing secrets manager from within the Lambda |
I got the error when using Java8 as my Handler runtime. When I upgraded to Java11, I was able to access the table. |
Thank you so much!! This worked for me |
Description
Before sam local version 0.52.0 everything works fine.Sam local environment can request data from cloud dynamodb. After I upgraded my sam local version to 1.0.0. When I debug my code in sam local environment. I got an error
"com.amazonaws.services.dynamodbv2.model.AmazonDynamoDBException: The security token included in the request is invalid (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: UnrecognizedClientException "
I can request data from dynamoDB with Java main function, so I have enough permission to request data from the dynamodb with ~/.aws/credentials (default)
I had test the same project and the same credentials in another PC with sam local 0.18.0, everything is fine.
Steps to reproduce
sam local start-api --host 127.0.0.1 -p 3000 --profile default
Observed result
sam local api start running after I run the command "sam local start-api --host 127.0.0.1 -p 3000 --profile default". But when lambda need to reqeust data from dynamoDB, There is an error"The security token included in the request is invalid"
Expected result
sam local should get data from cloud dynamoDB.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: 1.0.0sam local start-api --host 127.0.0.1 -p 3000 --profile default
The text was updated successfully, but these errors were encountered: