You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am testing a very basic service (based on https://github.com/serverless/examples/tree/v3/aws-ruby-simple-http-endpoint) using the serverless-ruby-package. It's been working perfectly as I carefully add more of my requirements to it. Execution started failing as soon as I added the gem 'mysql2' to the Gemfile. Here is the error in Cloudwatch:
{
"errorMessage": "libmariadb.so.3: cannot open shared object file: No such file or directory - /var/task/vendor/bundle/ruby/3.2.0/gems/mysql2-0.5.6/lib/mysql2/mysql2.so",
"errorType": "Init",
"stackTrace": [
"internal:/var/lang/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:37:in require'", "<internal:/var/lang/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in require'",
"/var/task/vendor/bundle/ruby/3.2.0/gems/mysql2-0.5.6/lib/mysql2.rb:36:in <top (required)>'", "<internal:/var/lang/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in require'",
"internal:/var/lang/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:37:in require'", "/var/task/handler.rb:2:in <top (required)>'",
"internal:/var/lang/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb:136:in require'", "<internal:/var/lang/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:136:in require'"
]
}
The mysql2.so file was built within the image and is present in the Docker image, in the vendor/ files, and is visible in the AWS Lambda console "Code" tab. Rebuilding the gems with Ruby 3.3 and deploying with the 3.3 Docker image also resulted in the same problem.
Aha, thank you @joshuaflanagan. That actually rings a bell from years ago. I'm sure that the AWS Lambda image for Ruby 3.2 will not have the mysql client pre-installed. I will look into this and report back.
I am testing a very basic service (based on https://github.com/serverless/examples/tree/v3/aws-ruby-simple-http-endpoint) using the serverless-ruby-package. It's been working perfectly as I carefully add more of my requirements to it. Execution started failing as soon as I added the
gem 'mysql2'
to the Gemfile. Here is the error in Cloudwatch:The mysql2.so file was built within the image and is present in the Docker image, in the vendor/ files, and is visible in the AWS Lambda console "Code" tab. Rebuilding the gems with Ruby 3.3 and deploying with the 3.3 Docker image also resulted in the same problem.
Serverless.yml excerpt:
Environment:
Docker Image (command "docker image ls"): amazon/aws-lambda-ruby 3.2 3f8c5310dbf8 11 days ago 683MB
Ruby: RVM using Ruby 3.2.3
The text was updated successfully, but these errors were encountered: