Skip to content

Commit 98673b0

Browse files
author
Kamil Sobol
authored
Handle CDK version mismatch (#2022)
1 parent a00533e commit 98673b0

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.changeset/rich-jokes-divide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/backend-deployer': patch
3+
---
4+
5+
Improve type error regex

packages/backend-deployer/src/cdk_error_mapper.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ const testErrorMappings = [
5555
EOL +
5656
` at lookup(/some_random/path.js: 1: 3005)`,
5757
},
58+
{
59+
errorMessage: `TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module ..../function/foo/resource.ts is not a valid package name imported from
60+
/Users/foo/Desktop/amplify-app/amplify/storage/foo/resource.ts
61+
at new NodeError (node:internal/errors:405:5)`,
62+
expectedTopLevelErrorMessage:
63+
'Unable to build the Amplify backend definition.',
64+
errorName: 'SyntaxError',
65+
expectedDownstreamErrorMessage: `TypeError [ERR_INVALID_MODULE_SPECIFIER]: Invalid module ..../function/foo/resource.ts is not a valid package name imported from
66+
/Users/foo/Desktop/amplify-app/amplify/storage/foo/resource.ts
67+
at new NodeError (node:internal/errors:405:5)`,
68+
},
5869
{
5970
errorMessage: 'Has the environment been bootstrapped',
6071
expectedTopLevelErrorMessage:

packages/backend-deployer/src/cdk_error_mapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export class CdkErrorMapper {
122122
},
123123
{
124124
errorRegex: new RegExp(
125-
`(SyntaxError|ReferenceError|TypeError):((?:.|${this.multiLineEolRegex})*?at .*)`
125+
`(SyntaxError|ReferenceError|TypeError)( \\[[A-Z_]+])?:((?:.|${this.multiLineEolRegex})*?at .*)`
126126
),
127127
humanReadableErrorMessage:
128128
'Unable to build the Amplify backend definition.',

0 commit comments

Comments
 (0)