Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/rich-jokes-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/backend-deployer': patch
---

Improve type error regex
11 changes: 11 additions & 0 deletions packages/backend-deployer/src/cdk_error_mapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,17 @@ const testErrorMappings = [
EOL +
` at lookup(/some_random/path.js: 1: 3005)`,
},
{
errorMessage: `TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module ..../function/foo/resource.ts is not a valid package name imported from
/Users/foo/Desktop/amplify-app/amplify/storage/foo/resource.ts
at new NodeError (node:internal/errors:405:5)`,
expectedTopLevelErrorMessage:
'Unable to build the Amplify backend definition.',
errorName: 'SyntaxError',
expectedDownstreamErrorMessage: `TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module ..../function/foo/resource.ts is not a valid package name imported from
/Users/foo/Desktop/amplify-app/amplify/storage/foo/resource.ts
at new NodeError (node:internal/errors:405:5)`,
},
{
errorMessage: 'Has the environment been bootstrapped',
expectedTopLevelErrorMessage:
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-deployer/src/cdk_error_mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class CdkErrorMapper {
},
{
errorRegex: new RegExp(
`(SyntaxError|ReferenceError|TypeError):((?:.|${this.multiLineEolRegex})*?at .*)`
`(SyntaxError|ReferenceError|TypeError)( \\[[A-Z_]+])?:((?:.|${this.multiLineEolRegex})*?at .*)`
Copy link
Contributor Author

@sobolk sobolk Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you wonder why ] is not escaped. it doesn't have to be if there's no opening [.
image

),
humanReadableErrorMessage:
'Unable to build the Amplify backend definition.',
Expand Down