Closed tlhampton13 closed 1 year ago
Can confirm that i am facing the same issue.
Apparently, the default cors_authorization_type config is nil, which then resolves to the route's authorization type. Managed to work around the issue by setting:
config.api.cors_authorization_type = "NONE"
@bolstycjw Thank you for this tip!
Checklist
jets upgrade
command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/My Environment
Expected Behaviour
I have declared authenticators for individual routes in routes.rb and have CORS enabled in application.rb. The CloudFormation generated for the corresponding API Gateway Methods should set the AuthorizationType and AuthenticatorId for the methods bound to routes with authenticators.
With CORS enabled an extra api gateway method get generated, with
*Cors*
in the name (e.g. PersonsPersonIdCorsApiMethod). This method should have both the AuthoriztaionType and AuthenticationId set.If CORS is disabled everything is fine.
Current Behavior
Currently, when CORS is enabled the extra
*Cors*
api gateway methods set the AuthorizationType, but not the AuthenticationId. This result in a CloudFormation error during deployment stating that an Authenticator must be provided.Step-by-step reproduction instructions
Code Sample
appication.rb
routes.rb
Excerpt from the generated CloudFormation code, after doing a
jet build
. Notice that the first method has both AuthorizationType and AuthorizerId, but the second*Cors*
method is missing the AuthorizerId.Solution Suggestion
When generating the
*Cors*
api gateway methods (e.g. PersonsPersonIdCorsApiMethod), the AuthentiatorId should also be set.