Fail to run SAM application locally when following AWS Lambda Foundations instructions

0

I'm doing the AWS Lambda Foundations course on Skill Builder, and having issues completing Lesson 8 of 12 Deploying and Testing Serverless Applications.

I followed the instructions to set up a Cloud9 environment, however there were slight differences between the steps in the instructions and the current required process. During the added step 2 of 5 I chose arm64, however kept the runtime at Node 14.0 as per the demonstration (step 3 of 5 in actual, step 2 of 4 in the skill builder lab)

Once created the following pop up appeared in the AWS Cloud9 console: Successfully created LambdaC9env. To get the most out of your environment, see Best practices for using AWS Cloud9

After entering the environment and creating the Lambda function and attempting to run it AWS Toolkit returns: Error: AWS Toolkit Failed to run SAM application locally

Terminal output: Invoking app.lambdaHandler (nodejs14.x) Local image was not found. Removing rapid images for repo public.ecr.aws/sam/emulation-nodejs14.x Building image................... Failed to build Docker Image NoneType: None Error: Error building docker image: The command '/bin/sh -c mv /var/rapid/aws-lambda-rie-arm64 /var/rapid/aws-lambda-rie && chmod +x /var/rapid/aws-lambda-rie' returned a non-zero code: 1 Command stopped: "sam local invoke"

Logs: 2023-10-16 04:22:20 [INFO]: SAM CLI location: [object Object] 2023-10-16 04:22:22 [INFO]: SAM CLI location: [object Object] 2023-10-16 04:22:22 [INFO]: Preparing to debug locally: Lambda "app.lambdaHandler" 2023-10-16 04:22:22 [INFO]: Building SAM application... 2023-10-16 04:22:24 [INFO]: SAM CLI location: [object Object] 2023-10-16 04:22:24 [INFO]: Command: (not started) [/usr/local/bin/sam build --build-dir /tmp/aws-toolkit-vscode/vsctk0FKvJ6/output --template /home/ec2-user/environment/LambdaSAMApp/template.yaml] 2023-10-16 04:22:24 [INFO]: SAM CLI not configured, using SAM found at: '/usr/local/bin/sam' 2023-10-16 04:22:30 [INFO]: Build complete. 2023-10-16 04:22:30 [INFO]: Starting SAM application locally 2023-10-16 04:22:32 [INFO]: SAM CLI location: [object Object] 2023-10-16 04:22:32 [INFO]: AWS.running.command 2023-10-16 04:22:32 [INFO]: SAM CLI not configured, using SAM found at: '/usr/local/bin/sam' 2023-10-16 04:22:32 [INFO]: Command: (not started) [/usr/local/bin/sam local invoke HelloWorldFunction --template /tmp/aws-toolkit-vscode/vsctk0FKvJ6/output/template.yaml -d 5858] 2023-10-16 04:22:36 [ERROR]: SamLaunchRequestError: Failed to run SAM application locally 2023-10-16 04:23:29 [INFO]: telemetry: sent batch (size=1)

And finally an additional popup appears in the Cloud9 console: Error loading your environments. AWS Cloud9 is unable to process the request. Please see the following details: Server message: "Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1"

I'm at a loss as I've tried to follow the instructions within the Skill Builder lesson as closely as possible. Is anyone able to help me identify why I'm not able to run the lambda function locally after setting up a Cloud9 environment?

No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions