Skip to content

Commit

Permalink
Handle CDK version mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolk committed Sep 18, 2024
1 parent cbac105 commit da44648
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
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 .*)`
),
humanReadableErrorMessage:
'Unable to build the Amplify backend definition.',
Expand Down

0 comments on commit da44648

Please sign in to comment.