lamby: uninitialized constant Rack::RACK_MULTITHREAD

Using rails 7.1.1, rack (3.0.8) and lamby (~> 5.2) Hard to get why those happen; I created a fresh app following the getting started and deploying via github actions. It does deploy without issues, but invariably getting the following error :

Executing 'config/environment.Lamby.cmd' in function directory '/app'
...
"errorMessage": "uninitialized constant Rack::RACK_MULTITHREAD"
...
2023-10-30T01:36:10.282+01:00 "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/rack_http.rb:45:in `env_base'"
...

Went through the rack code trying to find Rack::RACK_MULTITHREAD; not to be found

Then further below :

Init error when loading handler
--
  | 2023-10-30T01:36:10.282+01:00 | {
  | 2023-10-30T01:36:10.282+01:00 | "errorMessage": "wrong number of arguments (given 4, expected 2..3)",

This one looks related

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 45 (29 by maintainers)

Most upvoted comments

Thank you very much @jeremiahlukus and @metaskills! we’ve updated to v6 on our side 💪

I just did a commit to main add v6 to the Gemfile.lock. I also just tagged and release v6 to ruby gems. 🥳 Great work team!

Yes that part is not automated, if you want i could create a workflow for that but you would have to enter your keys in the secrets.

Awesome i forgot to bundle install after I upped the version ha.

Indeed thank you @thenano for helping debug some issues

merged waiting release

I do that right?

@jeremiahlukus spot on, everything works as expected! Thanks so much for all your time fixing this. I just did a bunch of browsing, download, etc, on my app and no errors.

Hey @jeremiahlukus thanks again for all your work on this. I have tested with rack 3.1.4 and 3.1.6. “Normal” rails controller calls are returning correctly (i.e. I can get html and data) but I’m getting errors when serving any assets, I get 500s for all js and css files served via the app:


2024-07-10T12:31:30.089+10:00 | Error raised from handler method
-- | --
  | 2024-07-10T12:31:30.089+10:00 | {
  | 2024-07-10T12:31:30.089+10:00 | "errorMessage": "source sequence is illegal/malformed utf-8",
  | 2024-07-10T12:31:30.089+10:00 | "errorType": "Function<JSON::GeneratorError>",
  | 2024-07-10T12:31:30.089+10:00 | "stackTrace": [
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/lib/ruby/3.3.0/json/common.rb:305:in `generate'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/lib/ruby/3.3.0/json/common.rb:305:in `generate'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/ruby/3.3.0/gems/activesupport-7.1.3.4/lib/active_support/json/encoding.rb:92:in `stringify'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/ruby/3.3.0/gems/activesupport-7.1.3.4/lib/active_support/json/encoding.rb:41:in `encode'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/ruby/3.3.0/gems/activesupport-7.1.3.4/lib/active_support/json/encoding.rb:23:in `encode'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/ruby/3.3.0/gems/activesupport-7.1.3.4/lib/active_support/core_ext/object/json.rb:42:in `to_json'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/aws_lambda_marshaller.rb:30:in `marshall_response'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/lambda_handler.rb:31:in `call_handler'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:81:in `run_user_code'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:59:in `start_runtime_loop'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:42:in `run'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:35:in `bootstrap_handler'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:8:in `start'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/bin/aws_lambda_ric:10:in `<top (required)>'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `load'",
  | 2024-07-10T12:31:30.089+10:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `<main>'"
  | 2024-07-10T12:31:30.089+10:00 | ]
  | 2024-07-10T12:31:30.089+10:00 | }

Let me know if you need any more info or if I need to change anything.

Thanks!

Ok finally fixed it that took longer than i’d like to admit. Ill send another PR

I’m in this statement too 😅

Hm i think i need to ensure multiValueHeaders is always a hash. I just pushed do you mind trying the latest?

Im able to reproduce

Hi @jeremiahlukus thanks for looking into this and pushing a fix! I’m not sure if I’m doing anything wrong, but I updated to lamby 5.1.2, and I’m still getting errors when trying to run with Rack 3.1.4, getting the following in my logs:


2024-06-27T13:27:52.055+10:00 | {
-- | --
  | 2024-06-27T13:27:52.055+10:00 | "errorMessage": "uninitialized constant Rack::VERSION",
  | 2024-06-27T13:27:52.055+10:00 | "errorType": "Function<NameError>",
  | 2024-06-27T13:27:52.055+10:00 | "stackTrace": [
  | 2024-06-27T13:27:52.055+10:00 | "/usr/local/bundle/ruby/3.3.0/gems/lamby-5.2.1/lib/lamby/rack_http.rb:41:in `env_base'",
  | 2024-06-27T13:27:52.055+10:00 | "/usr/local/bundle/ruby/3.3.0/gems/lamby-5.2.1/lib/lamby/rack.rb:33:in `env'",
  | 2024-06-27T13:27:52.055+10:00 | "/usr/local/bundle/ruby/3.3.0/gems/lamby-5.2.1/lib/lamby/handler.rb:89:in `call_app'",
...

Let me know if I’m doing something wrong or if I can provide any additional information.

thanks again!

I experienced this as well. I removed the constants in https://github.com/rails-lambda/lamby/pull/173 and it fixed the issue.

I experienced the same issue here.