aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
166 stars 55 forks source link

throw ESBuild error with correct messages #2020

Closed Amplifiyer closed 1 week ago

Amplifiyer commented 1 week ago

Problem

Currently if ESBuild running as a child process by CDK cli fails, CDK throws an error Failed to bundle asset..... without the actual error message. The actual error message is printed by the esbuild cli on the stderr which we skip scraping because of wrapping and throwing CDK error in an AmplifyError

Issue number, if available:

Changes

This PR prevents wrapping if the error for instantiating the NodeJSFunction construct is from esbuild and let the cdk_deployer scrape the stderr and throw meaningful message.

Corresponding docs PR, if applicable:

Validation

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

changeset-bot[bot] commented 1 week ago

🦋 Changeset detected

Latest commit: 13f417542e6fe3dc0c608dc34b34ad68c423dd02

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ----------------------------- | ----- | | @aws-amplify/backend-deployer | Patch | | @aws-amplify/backend-function | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR