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

Lambda function fails to build using Amplify hosting environment #14081

Closed
2 tasks done
pr0g opened this issue Jan 28, 2025 · 2 comments
Closed
2 tasks done

Lambda function fails to build using Amplify hosting environment #14081

pr0g opened this issue Jan 28, 2025 · 2 comments
Labels
pending-triage Issue is pending triage

Comments

@pr0g
Copy link

pr0g commented Jan 28, 2025

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

20.17.0

Amplify CLI Version

12.12.6

What operating system are you using?

Linux (amplify:al2023)

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

N/A

Describe the bug

We are experiencing an issue where when we deploy using Amplify Hosting (we push changes to a GitHub branch configured in the AWS Amplify Console settings), one of our Lambdas fails to build, however the overall build and deployment both are reported as having succeeded.

If you download the build .zip folder from AWS Lambda, the dist/ folder is completely missing, however building the function locally and deploying manually using aws lambda update-function-code --function-name <function> --zip-file fileb://$ZIPFILE --region=<region>, works successfully.

It seems the build is failing as part of the Amplify deployment, but is not being reported.

Expected behavior

If the code is valid, Amplify managed Lambda functions build correctly when doing an Amplify deployment. If there is an error and the code cannot be built, an error is reported and the overall deployment should fail.

Reproduction steps

I'm unfortunately unable to share our code to reproduce the issue, but can share the _LIVE_UPDATES values we're using for Amplify:

[{"pkg":"@aws-amplify/cli","type":"npm","version":"12.12.6"},
{"pkg":"node","type":"nvm","version":"20.17.0"},
{"pkg":"yarn","type":"npm","version":"1.22.22"}]

We also have NODE_OPTIONS set with --max_old_space_size=8192, and _CUSTOM_IMAGE set to amplify:al2023

This problem only seems to be affecting one of our functions, the others do appear to build and deploy correctly (they have a dist/ folder).

If there's a way to get any more detailed logs from the deployment to understand why the failure happened that would be very helpful. Right now looking in the Amplify build logs, I just see the function successfully being updated in CloudFormation.

UPDATE_COMPLETE    function<our-function>        AWS::CloudFormation::Stack Tue Jan 28 2025 09:55:58 GMT+0000 (Coordinated Universal Time)

Project Identifier

N/A

Log output

N/A

Additional information

If this makes any difference at all, the Lambda is a trigger which fires after changes to DynamoDB. The function interface looks like this...

export async function handler(event: DynamoDBStreamEvent): Promise<string> {
  ...
}

Before submitting, please confirm:

  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • I have removed any sensitive information from my code snippets and submission.
@pr0g pr0g added the pending-triage Issue is pending triage label Jan 28, 2025
@pr0g
Copy link
Author

pr0g commented Jan 28, 2025

Please ignore, tracked down the issue on our end to where I'd missed a line to build the TypeScript code we use for the Lambda.

@pr0g pr0g closed this as completed Jan 28, 2025
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

1 participant