Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Find Gems in 3.2 Runtime when bundled in lambci/lambda:build-ruby2.7 #55

Closed
nodanaonlyzuul opened this issue Sep 8, 2023 · 3 comments

Comments

@nodanaonlyzuul
Copy link

Hi @joshuaflanagan

Firstly - THANK YOU for this plugin. It's really simplified our build and deploy strategies.
It's great. I appreciate the work you and other contributors have put into it.

Cannot Find Gems in Deployed 3.2 Runtime

We recently updated a serverless project's runtime to ruby3.2 - and once it was deployed, it couldn't find gems.
A bit of digging uncovered that while the gems bundled (in the ephemeral lambci/lambda:build-ruby2.7 image) into vendor/bundle/ruby/2.7.0/...the setup.rb reads as:

require 'rbconfig'
ruby_engine = RUBY_ENGINE
ruby_version = RbConfig::CONFIG["ruby_version"]
path = File.expand_path('..', __FILE__)
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/aws-eventstream-1.1.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/aws-partitions-1.380.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/aws-sigv4-1.2.2/lib"

So in the runtime RbConfig::CONFIG["ruby_version"] will be evaluated as "3.2.0" - and the $LOAD_PATH array won't will build paths like:

.../2.7.0/gems/aws-eventstream-1.1.0/lib instead of the correct
.../3.2.0/gems/aws-eventstream-1.1.0/lib.

Does that make sense / jive with your experience?

Using a Maintained Image for Building

lambci/lambda is deprecated. They won't be building a 3.2 image.
Has there been any investigation into switching this repo to use the aws/aws-lambda-base-images images per lambci/lambda's deprecation suggestion?

@joshuaflanagan
Copy link
Owner

Have you upgraded to the 3.2 version of this plugin? It includes these changes #51 which added first class support for ruby 3.2, and switches to the official AWS container images.

Please let me know if there is still an issue after using the updating the plugin.

@nodanaonlyzuul
Copy link
Author

DOH!
That would do it....I've been cruising on 1.4.0 for a long time. Too long.
I've redeployed - this lambda will invoke over the weekend.

In the meantime - thanks for the response and apologies for not digging into the closed issues or latest in master.

@nodanaonlyzuul
Copy link
Author

It invoked. It worked just fine. Apologies again . THANK YOU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants