-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Closed
Labels
@aws-cdk/aws-appsyncRelated to AWS AppSyncRelated to AWS AppSyncbugThis issue is a bug.This issue is a bug.closing-soonThis issue will automatically close in 4 days unless further comments are made.This issue will automatically close in 4 days unless further comments are made.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp3response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Description
Describe the bug
When creating a new EventAPI from AppSync console, this is the default authorizationConfig you get:
This should be equivalent to the following code snippet:
const demoApi = new EventApi(this, "DemoApi", {
apiName: "demo-api"
});Which is also equivalent to this more verbose code snippet:
const demoApi = new EventApi(this, "DemoApi", {
apiName: "demo-api",
authorizationConfig: {
authProviders: [
{
authorizationType: AppSyncAuthorizationType.API_KEY,
},
],
connectionAuthModeTypes: [AppSyncAuthorizationType.API_KEY],
defaultPublishAuthModeTypes: [AppSyncAuthorizationType.API_KEY],
defaultSubscribeAuthModeTypes: [AppSyncAuthorizationType.API_KEY],
},
});Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
No response
Expected Behavior
I expected the following code to work:
const demoApi = new EventApi(this, "DemoApi", {
apiName: "demo-api"
});Current Behavior
I got the following error:
ValidationError: IAM Authorization mode is not configured on this API.
at path [cdk-aws-appsync-events-demo-dev/EventsApi] in aws-cdk-lib.aws_appsync.EventApiReproduction Steps
Create the following resource:
const demoApi = new EventApi(this, "DemoApi", {
apiName: "demo-api"
});Possible Solution
The current workaround is to enable IAM authorization mode, even if it is not needed or used.
const demoApi = new EventApi(this, "DemoApi", {
apiName: "demo-api",
authorizationConfig: {
authProviders: [
{
authorizationType: AppSyncAuthorizationType.API_KEY,
},
{
authorizationType: AppSyncAuthorizationType.IAM,
},
],
connectionAuthModeTypes: [AppSyncAuthorizationType.API_KEY],
defaultPublishAuthModeTypes: [AppSyncAuthorizationType.API_KEY],
defaultSubscribeAuthModeTypes: [AppSyncAuthorizationType.API_KEY],
},
});Additional Information/Context
No response
CDK CLI Version
2.178.2
Framework Version
No response
Node.js Version
22.13.0
OS
24.04.1
Language
TypeScript
Language Version
No response
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-appsyncRelated to AWS AppSyncRelated to AWS AppSyncbugThis issue is a bug.This issue is a bug.closing-soonThis issue will automatically close in 4 days unless further comments are made.This issue will automatically close in 4 days unless further comments are made.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp3response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
