Skip to content
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

Bug: SAM Deployment Issue: Bootstrap File Not Found Despite Successful Build and Upload #7329

Closed
xv-jeddy-tan opened this issue Aug 7, 2024 · 1 comment
Labels
stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Comments

@xv-jeddy-tan
Copy link

xv-jeddy-tan commented Aug 7, 2024

Description:

I am facing an issue with deploying a Golang SAM application in a monorepo setup. The deployment succeeds, but the API endpoint returns an internal service error. The error from CloudWatch indicates that the bootstrap file could not be found, despite being present in the expected location.

Steps to reproduce:

  1. Set up a repo and a simple Go app with the following structure:
- root
  - samconfig.yaml
  - functions
    - lambda-demo
      - main.go
      - template.yaml
  1. Populate the samconfig.yaml file with the following content:
version: 0.1

stg:
  global:
    parameters:
      s3_bucket: my-bucket
      region: us-east-1

  deploy:
    parameters:
      capabilities: CAPABILITY_IAM
      no_fail_on_empty_changeset: true
  1. Populate the template.yaml file with the following content:
AWSTemplateFormatVersion: 2010-09-09
Transform: "AWS::Serverless-2016-10-31"
Description: A sample SAM template for a Go Lambda function

Resources:
  LambdaDemoFunction:
    Type: AWS::Serverless::Function
    Metadata:
      BuildMethod: go1.x
    Properties:
      CodeUri: .
      FunctionName: lambda_demo
      Handler: bootstrap
      Runtime: provided.al2023
      Architectures: [arm64]
      MemorySize: 128
      Timeout: 100
      Description: lambda demo
      Events:
        Http:
          Type: Api
          Properties:
            Path: /demo
            Method: get
  1. Run the SAM build and deploy command:
sam build --config-file ../../samconfig.yaml --config-env stg
sam deploy --config-file ../../samconfig.yaml --config-env stg --stack-name lambda-demo-stg-stack --debug

Observed result:

Build and Deployment is successful, but accessing the API endpoint results in an internal service error. CloudWatch logs show the following error:

INIT_REPORT Init Duration: 0.17 ms	Phase: invoke	Status: error	Error Type: Runtime.InvalidEntrypoint


Error: Couldn't find valid bootstrap(s): [/var/task/bootstrap /opt/bootstrap]
Runtime.InvalidEntrypoint

The bootstrap file is in /functions/lambda-demo/.aws-sam/build/LambdaDemoFunction, but this build folder is not zipped and uploaded to S3 as intended. Instead, the entire lambda-demo directory is uploaded to S3.

Expected result:

The deployment should result in the correct packaging of the LambdaDemoFunction folder, ensuring the bootstrap binary is in the expected location, and this folder should be zipped and uploaded to S3, allowing the API endpoint to function correctly.

@xv-jeddy-tan xv-jeddy-tan added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Aug 7, 2024
@xv-jeddy-tan xv-jeddy-tan changed the title Bug: Bug: SAM Deployment Issue: Bootstrap File Not Found Despite Successful Build and Upload Aug 7, 2024
Copy link
Contributor

github-actions bot commented Aug 8, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.
Projects
None yet
Development

No branches or pull requests

1 participant