Skip to content

Wrong number of arguments error in send_error_response #15

Closed
@brunze

Description

@brunze

When my functions raise errors I get the following additional error printed out to the logs:

}
  Init error when loading handler
  {
    "errorMessage": "wrong number of arguments (given 4, expected 2..3)",
    "errorType": "Init<ArgumentError>",
    "stackTrace": [
      "/usr/local/bundle/gems/aws_lambda_ric-1.0.2/lib/aws_lambda_ric.rb:109:in `send_error_response'",
      "/usr/local/bundle/gems/aws_lambda_ric-1.0.2/lib/aws_lambda_ric.rb:98:in `rescue in run_user_code'",
      "/usr/local/bundle/gems/aws_lambda_ric-1.0.2/lib/aws_lambda_ric.rb:77:in `run_user_code'",
      "/usr/local/bundle/gems/aws_lambda_ric-1.0.2/lib/aws_lambda_ric.rb:59:in `start_runtime_loop'",
      "/usr/local/bundle/gems/aws_lambda_ric-1.0.2/lib/aws_lambda_ric.rb:42:in `run'",
      "/usr/local/bundle/gems/aws_lambda_ric-1.0.2/lib/aws_lambda_ric/bootstrap.rb:35:in `bootstrap_handler'",
      "/usr/local/bundle/gems/aws_lambda_ric-1.0.2/lib/aws_lambda_ric/bootstrap.rb:8:in `start'",
      "/usr/local/bundle/gems/aws_lambda_ric-1.0.2/bin/aws_lambda_ric:10:in `<top (required)>'",
      "/usr/local/bundle/bin/aws_lambda_ric:23:in `load'",
      "/usr/local/bundle/bin/aws_lambda_ric:23:in `<main>'"
    ]
}

I'm using the RIC with the Ruby Alpine docker images. Ruby version is 2.7.3p183.

It looks like a method signature mismatch in:

def send_error_response(lambda_invocation, err, exit_code = nil, runtime_loop_active: true)

I monkey patched it to def send_error_response(lambda_invocation, err, exit_code = nil, runtime_loop_active = true) (last parameter converted to positional parameter) and that seemed to fix it.

Either that or the call sites for send_error_response need to change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions