-
Notifications
You must be signed in to change notification settings - Fork 64
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
fix: specifically catch AppSync 'Code contains one or more errors' #2264
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@aws-amplify/backend-deployer': patch | ||
--- | ||
|
||
specifically catch AppSync "Code contains one or more errors" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -314,20 +314,7 @@ export class CdkErrorMapper { | |
errorName: 'InvalidPackageJsonError', | ||
classification: 'ERROR', | ||
}, | ||
{ | ||
// Error: .* is printed to stderr during cdk synth | ||
// Also extracts the first line in the stack where the error happened | ||
errorRegex: new RegExp( | ||
`^Error: (.*${this.multiLineEolRegex}.*at.*)`, | ||
'm' | ||
), | ||
humanReadableErrorMessage: | ||
'Unable to build the Amplify backend definition.', | ||
resolutionMessage: | ||
'Check your backend definition in the `amplify` folder for syntax and type errors.', | ||
errorName: 'BackendSynthError', | ||
classification: 'ERROR', | ||
}, | ||
|
||
{ | ||
// This happens when 'defineBackend' call is missing in customer's app. | ||
// 'defineBackend' creates CDK app in memory. If it's missing then no cdk.App exists in memory and nothing is rendered. | ||
|
@@ -362,6 +349,28 @@ export class CdkErrorMapper { | |
errorName: 'SecretNotSetError', | ||
classification: 'ERROR', | ||
}, | ||
{ | ||
errorRegex: /The code contains one or more errors/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. few thoughts:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That won't work either, the CFN error message is We can do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated Regex. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ty |
||
humanReadableErrorMessage: `A custom resolver used in your defineData contains one or more errors`, | ||
resolutionMessage: `Check for any syntax errors in your custom resolvers code.`, | ||
errorName: 'AppSyncResolverSyntaxError', | ||
classification: 'ERROR', | ||
}, | ||
// Generic error printed by CDK. Order matters so keep this towards the bottom of this list | ||
{ | ||
// Error: .* is printed to stderr during cdk synth | ||
// Also extracts the first line in the stack where the error happened | ||
errorRegex: new RegExp( | ||
`^Error: (.*${this.multiLineEolRegex}.*at.*)`, | ||
'm' | ||
), | ||
humanReadableErrorMessage: | ||
'Unable to build the Amplify backend definition.', | ||
resolutionMessage: | ||
'Check your backend definition in the `amplify` folder for syntax and type errors.', | ||
errorName: 'BackendSynthError', | ||
classification: 'ERROR', | ||
}, | ||
{ | ||
errorRegex: | ||
/(?<stackName>amplify-[a-z0-9-]+)(.*) failed: ValidationError: Stack:(.*) is in (?<state>.*) state and can not be updated/, | ||
|
@@ -388,6 +397,7 @@ export class CdkErrorMapper { | |
|
||
export type CDKDeploymentError = | ||
| 'AccessDeniedError' | ||
| 'AppSyncResolverSyntaxError' | ||
| 'BackendBuildError' | ||
| 'BackendSynthError' | ||
| 'BootstrapNotDetectedError' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just moved down in the order to catch more "generic" errors.