Skip to content

Ruby 3.0 Support? #14

Closed
Closed

Description

@metaskills

Now that Ruby 2.5 is on its way out, I am hoping that at some point in time there is an official Ruby 3.0 Runtime. Am I correct that this runtime interface will have to be updated at well? I ran the unit tests and only saw this one time format error.

  1) Failure:
HarnessTests#test_dependencies [/Users/kencollins/Repositories/aws-lambda-ruby-runtime-interface-client/test/unit/harness_test.rb:88]:
--- expected
+++ actual
@@ -1 +1 @@
-"{\"tomorrow\":\"2018-10-09T11:34:20.000+01:00\"}"
+"{\"tomorrow\":\"2018-10-09 11:34:20 +0100\"}"

Activity

  1. djpate commented on Jul 26, 2021

    @djpate
    Contributor

    We've been using it on prod. No issues so far.

  2. jstefek commented on May 23, 2022

    @jstefek

    When using with ruby 3.1 I get following error after the execution of my function finishes:

    Critical exception from handler
    {
    "errorMessage": "uninitialized constant #<Class:AwsLambda::Marshaller>::StringIO\n\n        when StringIO, IO\n             ^^^^^^^^",
    "errorType": "Function<NameError>",
    "stackTrace": [
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/aws_lambda_marshaller.rb:27:in `marshall_response'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/lambda_handler.rb:31:in `call_handler'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:81:in `run_user_code'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:59:in `start_runtime_loop'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:42:in `run'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:35:in `bootstrap_handler'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:8:in `start'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/bin/aws_lambda_ric:10:in `<top (required)>'",
    "/some/path/vendor/bundle/ruby/3.1.0/bin/aws_lambda_ric:25:in `load'",
    "/some/path/vendor/bundle/ruby/3.1.0/bin/aws_lambda_ric:25:in `<main>'"
    ]
    }
    Init error when loading handler
    {
    "errorMessage": "wrong number of arguments (given 4, expected 2..3)",
    "errorType": "Init<ArgumentError>",
    "stackTrace": [
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:109:in `send_error_response'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:98:in `rescue in run_user_code'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:77:in `run_user_code'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:59:in `start_runtime_loop'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric.rb:42:in `run'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:35:in `bootstrap_handler'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/lib/aws_lambda_ric/bootstrap.rb:8:in `start'",
    "/some/path/vendor/bundle/ruby/3.1.0/gems/aws_lambda_ric-2.0.0/bin/aws_lambda_ric:10:in `<top (required)>'",
    "/some/path/vendor/bundle/ruby/3.1.0/bin/aws_lambda_ric:25:in `load'",
    "/some/path/vendor/bundle/ruby/3.1.0/bin/aws_lambda_ric:25:in `<main>'"
    ]
    }
    

    so I had to set Retry attempts to 0 for the lambda.

    Seems like monkey patch as mentioned here: #15 works.
    I had to add to my handler following:

    require 'aws_lambda_ric'
    require 'io/console'
    require 'stringio'
    
    module AwsLambdaRuntimeInterfaceClient
      class LambdaRunner
    
        def send_error_response(lambda_invocation, err, exit_code = nil, runtime_loop_active = true)
          error_object = err.to_lambda_response
          @lambda_server.send_error_response(
            request_id: lambda_invocation.request_id,
            error_object: error_object,
            error: err,
            xray_cause: XRayCause.new(error_object).as_json
          )
    
          @exit_code = exit_code unless exit_code.nil?
          @runtime_loop_active = runtime_loop_active
        end
      end
    end
    
    
  3. rberger commented on Sep 29, 2022

    @rberger

    I'm not clear if the current lambda runtime does support Ruby 3.x or not. This thread seems to be saying it does, but the README says:

    The Ruby Runtime Interface Client package currently supports Ruby versions:

    • 2.5.x up to and including 2.7.x
  4. rberger commented on Nov 17, 2022

    @rberger

    Will there ever be Ruby 3.x support?

  5. rberger commented on Dec 1, 2022

    @rberger

    If Ruby 3x support is not imminent, any pointers on building a custom ruby 3 runtime?

  6. rjhornsby commented on Dec 2, 2022

    @rjhornsby

    If Ruby 3x support is not imminent, any pointers on building a custom ruby 3 runtime?

    Ruby 2.7 is EOL in 3 months. Ruby 3.0 was released GA two years ago. I hesitate to throw my hands up and say we're not getting Ruby 3.x support for our Lambda functions, but it certainly seems like if it was going to be a thing it should have been done by now.

    Two years after the GA release I think we can safely agree that Ruby 3.0 isn't bleeding edge. I also understand that NodeJS and Python are all the rage (and there's nothing wrong with Python), but I have to imagine that we're far from alone in being a mostly Ruby shop because we're a Chef shop - which naturally means also doing most of our non-chef work in Ruby.

  7. metaskills commented on Dec 4, 2022

    @metaskills
    Author

    I can confirm this gem works fine with any modern Ruby I have thrown at it. We use the Ruby RIC for all our K8s images to get EventBridge rules. I also updated the Rails on Lambda (Lamby) cokoiecuter project using Debian images with the RIC on Ruby 3.1, works great. rails-lambda/lamby-cookiecutter#21

    Hope that helps!

  8. dimasusername commented on Feb 16, 2023

    @dimasusername

    Ruby 3 aside, we desperately need a fresh release, monkey-patching fixes as mentioned here (kudos to @jstefek) is not the way to go

  9. wildodecisiv commented on Mar 2, 2023

    @wildodecisiv

    Hello Everyone!
    Recently in my team we were planning to upgrade all our serverless app from ruby 2.7 (native runtime) to 3.2 (using docker container), however we recently received an email from AWS Support saying that they will add native runtime support for Ruby 3.2 at the end of Q2 2023.
    In the same way, I want to share with you a simple HelloWorld project using AWS SAM, Rbenv + Ruby 3.2.1 and Docker, hope it helps to someone that will decide to still use this approach instead to wait the native support

    https://github.com/wildomonges/lambda-ruby3.2-container-image

    Kind Regards!

  10. added a commit that references this issue on Aug 2, 2023
  11. romiras commented on Oct 12, 2024

    @romiras

    Despite a request for Ruby 3 support being made a long time ago, this issue is no longer relevant since Ruby 3 is unfortunately EOL.

  12. rjhornsby commented on Oct 12, 2024

    @rjhornsby

    Despite a request for Ruby 3 support being made a long time ago, this issue is no longer relevant since Ruby 3 is unfortunately EOL.

    To be more specific, Ruby 3.0 is deprecated. Ruby 3.x isn't going anywhere and is active development, with 3.3 being current.

    https://endoflife.date/ruby

  13. mullermp commented on Feb 21, 2025

    @mullermp
    Contributor

    This should be resolved with https://rubygems.org/gems/aws_lambda_ric and the latest main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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