Mounted rack apps breaks when deployed to AWS (bug not present locally)
Closed this issue · 3 comments
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.boltops.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
I am upgrading Jets from 3.0.0
to 3.1.1
Expected Behaviour
Jets should not be throwing a ArgumentError
Current Behavior
Stacktrace:
{
"errorMessage": "wrong number of arguments (given 3, expected 2)",
"errorType": "Function<ArgumentError>",
"stackTrace": [
"/opt/ruby/gems/2.7.0/gems/jets-3.1.1/lib/jets/controller/rack/adapter.rb:13:in `initialize'",
"/opt/ruby/gems/2.7.0/gems/jets-3.1.1/lib/jets/internal/app/controllers/jets/bare_controller.rb:13:in `new'",
"/opt/ruby/gems/2.7.0/gems/jets-3.1.1/lib/jets/internal/app/controllers/jets/bare_controller.rb:13:in `process!'",
"/opt/ruby/gems/2.7.0/gems/jets-3.1.1/lib/jets/controller/base.rb:35:in `process'",
"app/controllers/jets/mount_controller.rb:1:in `run'",
"/opt/ruby/gems/2.7.0/gems/jets-3.1.1/lib/jets/processors/main_processor.rb:32:in `instance_eval'",
"/opt/ruby/gems/2.7.0/gems/jets-3.1.1/lib/jets/processors/main_processor.rb:32:in `run'",
"/opt/ruby/gems/2.7.0/gems/jets-3.1.1/lib/jets/core.rb:120:in `process'",
"/var/task/handlers/controllers/jets/mount_controller.rb:6:in `call'"
]
}
Step-by-step reproduction instructions
Mount any rack app, deploy it and hit the endpoint
Solution Suggestion
Seems like the bug was introduced in this commit fcda689
meth
was removed as an argument in multiple places but it appears this place was missed https://github.com/boltops-tools/jets/blob/master/lib/jets/internal/app/controllers/jets/bare_controller.rb#L13
I tested and verified the following monkey patch fixes this issue:
module Jets
module BareControllerExtentions
private
def process!
status, headers, body = dispatch!
adapter = Jets::Controller::Rack::Adapter.new(event, context)
adapter.convert_to_api_gateway(status, headers, body)
end
end
class BareController
prepend BareControllerExtentions
end
end
However, I'm not too familiar with the codebase so I'm not sure if this is the correct/best place to fix the bug. This can probably fixed further up or down the callstack.
I'm getting this error as well using Jets 3.0.23.
Did you have to revert to a lower version or did you have another workaround?