aws-samples / aws-samples/bedrock-chat

[BUG] BackendApiHandlerV2 lambda function failing to stabilize

Open
#894 3 comments 0 reactions 0 assignees View on GitHub
bug needs investigation
Dominant language
TypeScript
Stars
1.3k
Forks
535
Avg merge
1d 12h
Merged PRs (30d)
10

Description

## 🚨 **Please Note** 🚨

To ensure efficient investigation of the issue, please fill out the fields below with as much detail as possible. **Reports that do not follow this template may be closed without notification.** We appreciate your cooperation.

## 🐞Describe the bug

Lambda function deployment fails with "cannot execute: required file not found" error for run.sh. The Lambda function cannot stabilize during CDK deployment because the run.sh file is not included in the Lambda package during the bundling process, even though the file exists in the build context.

Any help or reason why this is happening is much appreciated.

## 🔄 To Reproduce

Steps to reproduce the behavior:

1. Fork the repo and Clone it.
2. Navigate to cdk directory and npm ci
3. Set Docker platform: export DOCKER_DEFAULT_PLATFORM=linux/amd64
4. Deploy with CDK: npx cdk deploy --require-approval never --all --profile [my profile name]
5. See error during deployment

## 📷 Screenshots
The below screenshot shows the logs when it deploys with enableLambdaSnapStart = false. It deploys but the chat history and bots do not load.
Image

The below screenshot shows the logs for when enableLambdaSnapStart = true. It does not deploy and rollback.
Image

## 🔎 Logs for Chat Issues

ROLLBACK_COMPLETE: Resource handler returned message: "Resource of type 'AWS::Lambda::Version' with identifier 'arn:aws:lambda:eu-west-2:[my id]:function:BedrockChatStack-BackendApiHandlerV263FCB936-Si7qSJAcrHOe:1' did not stabilize. Status Reason is An error occurred during function initialization." (RequestToken: b49db3e2-09ad-815a-26f2-8d04ed4fe18d, HandlerErrorCode: NotStabilized)

## 📝 Additional context
- Using latest version of node. I have also tested with node 20.x
- Docker desktop is running whilst deploying
- Running cdk deploy --require-approval never --all into the target account
- Error is the output to the terminal
- Latest version of docker
- Windows machine
- Deploying to eu-west-2 (which has previously worked)

Contributor guide

Open the contributing guide

Research direction

Start in the cdk directory and inspect the Lambda bundling context to determine why run.sh is omitted from the deployment package. Reproduce with npm ci and the documented cdk deploy command, using the stated Docker platform setting. Done means the Lambda version stabilizes during deployment and chat history and bots load successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, docker, typescript
Domain
backend, build-system, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.