rubyonjets/jets

Specifying the authorizer in the routes.rb with CORS enabled breaks jets.

iqre8 opened this issue · 1 comments

iqre8 commented

Specifying the authorizer in the routes.rb with CORS enabled breaks jets.

Checklist

  • Upgrade Jets: Are you using the latest version of Jets? This allows Jets to fix issues fast. There's a jets upgrade command that makes this a simple task. There's also an Upgrading Guide: http://rubyonjets.com/docs/upgrading/
  • Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.rubyonjets.com
  • Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.

My Environment

Software Version
Operating System OSX 10.13.6
Jets 2.3.16
Ruby ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-darwin17]

Expected Behaviour

jets deploy should work. CORS should be enabled.

Current Behavior

When enabling CORS or when specifying the authorizer in routes.rb causes a deployment failure.
When trying to manually enable CORS in AWS you see "Invalid Response status code Specified"

Step-by-step reproduction instructions

Enable CORS
Specify the authorizer in the routes.rb
Perform a jets deploy

03:40:19PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack api-dev User Initiated
03:40:23PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack ApiGateway 
03:40:23PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack JetsPreheatJob 
03:40:23PM UPDATE_COMPLETE AWS::CloudFormation::Stack ApiGateway 
03:40:25PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack ApiResources1 
03:40:26PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack MainAuthorizer 
03:40:26PM UPDATE_COMPLETE AWS::CloudFormation::Stack ApiResources1 
03:40:28PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack JetsPublicController 
03:40:37PM UPDATE_FAILED AWS::CloudFormation::Stack MainAuthorizer Embedded stack arn:aws:cloudformation:eu-west-1:123456789024:stack/api-dev-MainAuthorizer-ABCDEFGHIJKL/e4aa2950-87ec-11ea-9236-01234567890a was not successfully updated. Currently in UPDATE_ROLLBACK_IN_PROGRESS with reason: The following resource(s) failed to update: [MyCognitoAuthorizer]. 
03:40:37PM UPDATE_FAILED AWS::CloudFormation::Stack JetsPreheatJob Resource update cancelled
03:40:48PM UPDATE_FAILED AWS::CloudFormation::Stack JetsPublicController Resource update cancelled
03:40:48PM UPDATE_ROLLBACK_IN_PROGRESS AWS::CloudFormation::Stack api-dev The following resource(s) failed to update: [JetsPublicController, MainAuthorizer, JetsPreheatJob]. 

Code Sample

iqre8/jets-example-api@cc051aa

Solution Suggestion

For now I just enable CORS, and specify the authorizer in the controller.

Dug into this. Tried to reproduce and wasn't able to. Guessing that some point between 2.3.16 and the current version it was fixed. Thanks for the report.