Questions tagged [aws-sam-cli]

AWS SAM Local allows developers to run & debug AWS Lambda code on local machine using Docker. AWS Lamda is a part of Amazon Web Services (AWS).

AWS SAM Local allows developers to run & debug AWS Lambda code on local machine using Docker. AWS Lamda is a part of Amazon Web Services (AWS).

Resources

512 questions
3
votes
0 answers

sam build is stuck in NpmInstall when oracledb-for-lambda is included in package.json

I am using AWS SAM and Node.js. When I run "sam build, it is always stuck in NpmInstall. I noticed that this only happens when I added the oracledbdb-for-lambda package. I tried it with express and other npm packages and it works.
Jiji
  • 1,092
  • 3
  • 15
  • 36
3
votes
0 answers

AWS, serverless SAM template - publishing nested applications

I have defined AWS Serverless nested applications within my root SAM template by using Location property pointing to my local file system (as advised here - Defining a Nested Application from the Local File System). Packaging and deploying work…
3
votes
1 answer

cannot install aws-sam-cli on macos catalina with brew gdbm not present or broken

Following instructions on https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-mac.html: (venv) dougbergh@192 de % brew install aws-sam-cli Updating Homebrew... ==> Installing…
Doug Bergh
  • 153
  • 1
  • 12
3
votes
2 answers

Sam local Invoke lambda with local layer error "unable to import package"

When using 'Sam local invoke'to invoke a lambda locally , which relies on a layer built locally as well, the function cannot find the module which is part of the layer. I am getting the error "unable to import package" error while invoking my lambda…
3
votes
1 answer

How can I utilize AWS::Serverless::LayerVersion in order to use external libraries in my AWS Lambda functions

I need to use external library that is located on my local file system in order to successfully execute my Lambda function. Using AWS SAM framework I found out that this can be done by specifying AWS::Serverless::LayerVersion resource. What I am not…
3
votes
1 answer

Updating Lambda to AWS through intellij plugin

I'm uploading a Spring Application to a Lambda function on AWS through IntelliJ's AWS Toolkit but when uploading the code to the S3 bucket it runs sam build and yields the following error: 2019-04-23 19:44:41 Building resource 'Function' 2019-04-23…
3
votes
1 answer

How to both run an AWS SAM template locally and deploy it to AWS successfully (with Java Lambdas)?

I'm trying to build an AWS application using SAM (Serverless Application Model) with the Lambdas written in Java. I was able to get it running locally by using a resource definition like this in the template: Resources: HelloWorldFunction: …
MJV
  • 1,782
  • 2
  • 21
  • 33
3
votes
1 answer

API Name is always the Stack Name in SAM

I am using the AWS CLI to deploy a SAM template. The AWS Api Name is being set to the same as the CloudFormation Stack Name. I expected the Api to be called "Users" based on this template content below. Is it possible to set the API name? SAM…
3
votes
1 answer

How to test cloudformation lambda functions locally?

Usecase I have cloudformation stack which has around 25 lambda functions. Before deploying into production i need to test all the functions locally. I know aws has SAM Cli to test serverless functions which has completely different syntax when…
Private
  • 1,661
  • 1
  • 20
  • 51
3
votes
1 answer

Can SAM create the s3 bucket to store the lambda function code?

Perhaps this is more than one question. Tried to sign up to the SAM Slack channel, but no success. I am trying out SAM to build a serverless app. I am used to having a Cloudformation template to describe all the resources needed. Now I am confused…
jbasko
  • 7,028
  • 1
  • 38
  • 51
3
votes
1 answer

AWS SAM managed policy for SSM get parameter

Is there any managed policy similar to DynamoDBReadPolicy for the ssm:GetParameter* permission for a Lambda function? I'm using aws-sam-cli and trying to follow this, but when I try to fetch the parameters when using sam local start-api, I get the…
3
votes
0 answers

SAM LOCAL - Cognito username in event missing - how to hook this up?

I am using SAM LOCAL and start-api to test my lambda functions using postman. I use Cognito for user authentication and pass the cognito token to the API Gateway. In production, it works fine. I need the username from Cognito (requestContext:…
sgiot
  • 31
  • 2
3
votes
3 answers

Not authorized to perform: dynamodb:Scan Lambda

I need to scan a dynamodb database but I keep getting this error: "errorMessage": "An error occurred (AccessDeniedException) when calling the Scan operation: User: arn:aws:sts::747857903140:assumed-role/test_role/TestFunction is not …
Harry
  • 1,021
  • 4
  • 21
  • 41
3
votes
0 answers

How do I read an s3 bucket from AWS SAM local

I have a lambda that I wish to test locally using AWS SAM local. The lambda needs to read from an s3 bucket on the cloud. How do I allow this to happen from the AWS SAM local environment? thanks Angus
angusrose
  • 143
  • 1
  • 3
  • 13
3
votes
0 answers

Got an error on aws-sam-cli official tutorial when invoking function

I had error when I did aws-sam-cli official tutorial below. https://github.com/awslabs/aws-sam-cli#invoke-functions-locally The tutorial says that command below is invoking function. $ sam local invoke "Ratings" -e event.json But after doing below…
oranbebas
  • 31
  • 2