[aws-appsync] API always generates API key even when other default auth mode is set #9054
Labels
@aws-cdk/aws-appsync
Related to AWS AppSync
bug
This issue is a bug.
in-progress
This issue is being actively worked on.
needs-triage
This issue or PR still needs to be triaged.
When I set a
defaultAuthorization
prop on theGraphQLApi
and use something different than "API_KEY" it gets set correctly but the Key gets generated anyway.Reproduction Steps
and see in the Cloudformation template the following
a workaround is to set an empty array as the additional auth types
Error Log
Environment
1.51.0
1.51.0
14.3.0
Other
The line responsible is
aws-cdk/packages/@aws-cdk/aws-appsync/lib/graphqlapi.ts
Lines 342 to 346 in cec382c
The right handside of the or (
||
) uses optional chaining, hence ifadditionalAuthorizationModes
is undefinedadditionalAuthorizationModes?.findIndex(...)
returnsundefined
which is not strictly equal to-1
.I would propose the following fix:
using
Array.prototype.some()
instead ofArray.prototype.findIndex()
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: