Comments (6)
I just rebuilt the gem with the latest images and published v0.5.3.2. Can you try that out?
from mysql2-lambda.
unfortunately still same issue:
irb(main):001:0> require 'mysql2'
Traceback (most recent call last):
10: from /var/lang/bin/irb:23:in `<main>'
9: from /var/lang/bin/irb:23:in `load'
8: from /var/lang/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
7: from (irb):1
6: from /var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:149:in `require'
5: from /var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:160:in `rescue in require'
4: from /var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:160:in `require'
3: from /var/task/vendor/bundle/gems/mysql2-lambda-0.5.3.2/lib/mysql2.rb:36:in `<top (required)>'
2: from /var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
1: from /var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'
LoadError (/var/task/vendor/bundle/gems/mysql2-lambda-0.5.3.2/lib/mysql2/mysql2.so: cannot open shared object file: No such file or directory - /var/task/vendor/bundle/gems/mysql2-lambda-0.5.3.2/lib/mysql2/mysql2.so)
from mysql2-lambda.
It seems a arch-related issue!
Forcing the platform to linux/amd64 works:
Dockerfile:
FROM --platform=linux/amd64 public.ecr.aws/lambda/ruby:2.7
# Copy dependency management file
COPY lambda/Gemfile ${LAMBDA_TASK_ROOT}
# Install dependencies under LAMBDA_TASK_ROOT
ENV GEM_HOME=${LAMBDA_TASK_ROOT}/vendor/bundle
RUN bundle install
# Copy function code
COPY lambda ${LAMBDA_TASK_ROOT}
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "lambda_function.LambdaFunction::Handler.process" ]
Sh:
sh-4.2# arch
x86_64
sh-4.2# irb
irb(main):001:0> require 'mysql2'
=> true
irb(main):002:0>
from mysql2-lambda.
Oh! So your image is amd64? I've never published a gem with multiple architecture needs before. Do you have thoughts on that? Should I publish a mysql2-lambda-amd64
?
from mysql2-lambda.
Actually, to make it work I had to force my image to be based on amd64 version. On my M1, by default it uses the arm64 base image. Considering that using arm64 is an option on Lambda, would be great to have the option.
from mysql2-lambda.
It could. I'd like to consider this project deprecated given we now have Lambda Containers and can easily install the needed development/build and/or runtime dependencies as needed in each of our containers. I recently provided an example in the new Lamby Cookiecutter work which is based on Ruby 3.1 official Debian images. Details here:
rails-lambda/lamby-cookiecutter#21
from mysql2-lambda.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysql2-lambda.