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
4
votes
0 answers

Create multiple API Gateway stages with different integrations

I'm trying to create a lambda function associate with an API Gateway. A new lambda version for that function will be created whenever new version is deployed, this version will have this ARN arn:lambda_arn:[version]. Also a new API Gateway stage…
Amer Sawan
  • 2,126
  • 1
  • 22
  • 40
4
votes
5 answers

Sam build fails with: Build Failed Error: NodejsNpmBuilder:NpmPack - NPM Failed: npm ERR! code Z_DATA_ERROR

I'm learning how to create lambdas on aws. I'm following this official tutorial. The commands I run: sam init (default values for everything, I'm choosing template 8 - webapp backend) cd sam-app sam build The output I'm getting is: Building codeuri:…
aurelia
  • 493
  • 8
  • 12
4
votes
1 answer

Sam build in intellij: Error: JavaMavenWorkflow:MavenBuild - 'utf-8' codec can't decode byte 0xbb in position 150889: invalid start byte

I am working with an aws serverless architecture with spring boot application. When I some time build the project using sam build in intellij, I am getting the following error. Building codeuri: . runtime: java11 metadata: {} functions:…
4
votes
2 answers

How to debug and run multiple lambdas locally

I would like to build .NET HTTP API using aws lambdas. These lambdas will be called by UI and some other systems via api gateway. Obviously in local environment I would like to run/debug these. What I have tried: a) Using the mock tool that comes…
Toni Parviainen
  • 2,217
  • 1
  • 16
  • 15
4
votes
1 answer

How to change AWS API Gateway default responses with SAM template?

I have an API with AWS API Gateway and Go Lambda functions. I have an issue, each time when i deploy new version of SAM it Overwrite Gateway responses on API Gateway. I tried to put it in SAM template but it seems it does not work or I'm not doing…
4
votes
1 answer

AWS SAM starting local api returns "Function name is required" error

We are using CDK to build our infrastructure configuration. Moreover, I create my template.yml for SAM with cdk synth --no-staging > template.yml if it helps. I am using AWS Toolkit to invoke/debug my lambda functions on Intellij which…
quartaela
  • 2,579
  • 16
  • 63
  • 99
4
votes
2 answers

How to attach authorization/api key to the sam cli generated api?

I used sam cli , to create a project. when I package this and deploy , it creates the lambda and also the api gateway with stage and prod stages, policy, roles e.t.c by default, without having to explicitly define in the cloudformation template (…
ozil
  • 599
  • 7
  • 31
4
votes
1 answer

how to use aws sam cli with volumes --docker-volume-basedir

I have sam initiated on local machine and below is the directory structure - application (python3 code) - efs (got some files) - template-local.yaml Now, How do I tell sam local to start api with volume attachs. I am running below command sam…
Rafee
  • 3,975
  • 8
  • 58
  • 88
4
votes
1 answer

SAM build in container with environment variables

Is there a way to pass environment variables to the container doing the build in: sam build --use-container In the sam build documentation, in parameters related to Docker, there is only --docker-network and --skip-pull-image Use case: I am using…
forzagreen
  • 2,509
  • 30
  • 38
4
votes
1 answer

AWS SAM template doesn't execute BuildMethod

I have a lambda functions that has somewhat non standard packaging. I am using a Makefile to help me package what I need and use it as my build method with sam build command. However I don't see this makefile being executed. Can't figure out why…
HIT_girl
  • 785
  • 7
  • 23
4
votes
0 answers

Including local source code directories and files in aws-sam?

I work in a mono repo where I have a AWS SAM (lambda) application. The structure is more or less like so: . ├── my_folder1   ├── file1.py   ├── __init__.py    └── file2.py    ├── my_folder2    │   └── my_folder3    │   ├── __init__.py …
4
votes
2 answers

run locally Step Function defined in a SAM template

I follow the guide https://docs.aws.amazon.com/step-functions/latest/dg/sfn-local-lambda.html to run locally a Step Function defined inline. But I don't found any guide how to test locally a Step Function defined into a SAM template…
Hey Teacher
  • 1,215
  • 13
  • 17
4
votes
1 answer

How to generate an event with SAM local generate event with queryparameters?

I can generate an event like this in SAM sam local generate-event apigateway aws-proxy --method GET --path document --body "{"test": "1", "tests2": "2"}" > local-event.json But this does not really help me because I do not send a body to my…
4
votes
1 answer

SAM Lambda: [ERROR] Runtime.ImportModuleError: Unable to import module 'index': No module named 'pg8000'

I've deployed a lambda (python3.7) which uses pg8000 import pg8000 .. def get_connection(): """ Method to establish the connection. """ try: print ("Connecting to database") # Create a low-level client with the…
DenCowboy
  • 13,884
  • 38
  • 114
  • 210
4
votes
1 answer

Sam build failed for nodejs 10.x runtime is not supported

i have ubuntu v18.10 , with aws cli Version: 0.14.2, i am not able to run sam build command , it gives error Building resource 'TestFunction' Build Failed Error: 'nodejs10.x' runtime is not supported
Swadeshi
  • 1,596
  • 21
  • 33