Skip to content

Commit

Permalink
chore(appsync): improve error message for missing iam authorization mode
Browse files Browse the repository at this point in the history
  • Loading branch information
garysassano committed Feb 19, 2025
1 parent b16fac2 commit 1c05580
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/aws-cdk-lib/aws-appsync/lib/eventapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ export abstract class EventApiBase extends ApiBase implements IEventApi {
*/
public grant(grantee: IGrantable, resources: AppSyncEventResource, ...actions: string[]): Grant {
if (!this.authProviderTypes.includes(AppSyncAuthorizationType.IAM)) {
throw new ValidationError('IAM Authorization mode is not configured on this API.', this);
throw new ValidationError('Cannot use grant method because IAM Authorization mode is not present in the auth providers on this Event API.',
this,
);
}
return Grant.addToPrincipal({
grantee,
Expand Down

0 comments on commit 1c05580

Please sign in to comment.