rails-lambda / lamby-cookiecutter

🐑🛤 AWS SAM Cookiecutter to Quick Start Rails & Lambda
https://lamby.cloud/docs/quick_start
37 stars 18 forks source link

"errorMessage": "uninitialized constant Rack::RACK_MULTITHREAD" #41

Closed hungnv-sr closed 1 month ago

hungnv-sr commented 1 year ago

I followed this guide throughoutly, I even switched between arm amd architecture. https://lamby.cloud/docs/quick-start.

However, I got this error when accessing function URL:


2023-10-27T18:32:08.670+07:00 | Executing 'config/environment.Lamby.cmd' in function directory '/app'
-- | --
  | 2023-10-27T18:32:11.579+07:00 | EXTENSION Name: crypteia State: Ready Events: [INVOKE, SHUTDOWN]
  | 2023-10-27T18:32:11.581+07:00 | START RequestId: e92dc6d6-3e03-4967-9620-44a5b05fa74a Version: 3
  | 2023-10-27T18:32:11.584+07:00 | Critical exception from handler
  | 2023-10-27T18:32:11.585+07:00 | {
  | 2023-10-27T18:32:11.585+07:00 | "errorMessage": "uninitialized constant Rack::RACK_MULTITHREAD",
  | 2023-10-27T18:32:11.585+07:00 | "errorType": "Function<NameError>",
  | 2023-10-27T18:32:11.585+07:00 | "stackTrace": [
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/rack_http.rb:45:in `env_base'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/rack.rb:33:in `env'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/handler.rb:89:in `call_app'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/handler.rb:47:in `call'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby/handler.rb:8:in `call'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby.rb:31:in `handler'",
  | 2023-10-27T18:32:11.585+07:00 | "/app/vendor/bundle/ruby/3.2.0/gems/lamby-5.2.0/lib/lamby.rb:25:in `cmd'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/lambda_handler.rb:26:in `call_handler'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:81:in `run_user_code'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:59:in `start_runtime_loop'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:42:in `run'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:35:in `bootstrap_handler'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:8:in `start'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/bin/aws_lambda_ric:10:in `<top (required)>'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `load'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `<main>'"
  | 2023-10-27T18:32:11.585+07:00 | ]
  | 2023-10-27T18:32:11.585+07:00 | }
  | 2023-10-27T18:32:11.585+07:00 | Init error when loading handler
  | 2023-10-27T18:32:11.585+07:00 | {
  | 2023-10-27T18:32:11.585+07:00 | "errorMessage": "wrong number of arguments (given 4, expected 2..3)",
  | 2023-10-27T18:32:11.585+07:00 | "errorType": "Init<ArgumentError>",
  | 2023-10-27T18:32:11.585+07:00 | "stackTrace": [
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:109:in `send_error_response'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:98:in `rescue in run_user_code'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:77:in `run_user_code'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:59:in `start_runtime_loop'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:42:in `run'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:35:in `bootstrap_handler'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:8:in `start'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/gems/aws_lambda_ric-2.0.0/bin/aws_lambda_ric:10:in `<top (required)>'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `load'",
  | 2023-10-27T18:32:11.585+07:00 | "/usr/local/bundle/bin/aws_lambda_ric:25:in `<main>'"
  | 2023-10-27T18:32:11.585+07:00 | ]
  | 2023-10-27T18:32:11.585+07:00 | }

Surprisingly, if I invoke the function manually, it only returned 404. The error only occurs when I used Function URL or API Gateway request.

andreimerfu commented 9 months ago

Same issue here.

Edit: Fixed by downgrading the rack version to 2.2.6.4

vkinelev commented 8 months ago

Yes, the same issue, and also solved it by downgrading the rack gem. Thank you @andreimerfu for sharing the workaround.

These gem versions worked for me:

gem "rack", "2.2.8.1"
gem "rack-session", "1.0.1"
jeremiahlukus commented 5 months ago

I am using rack (3.0.11) in a new rails project I deployed using lamby. Its probably best to create a new rails project then copy over files from the cookie cutter project you want.

jeremiahlukus commented 1 month ago

Fixed in Lamby v6