stevenringo / lambda-ruby-pg-nokogiri Goto Github PK
View Code? Open in Web Editor NEWHow to ensure binary dependencies are available for gems such as pg (postgres) and nokogiri are configured correctly in Ruby on AWS Lambda
How to ensure binary dependencies are available for gems such as pg (postgres) and nokogiri are configured correctly in Ruby on AWS Lambda
Getting this error during Docker build:
Error: Package: pgdg-redhat-repo-42.0-5.noarch (/pgdg-redhat10-10-2.noarch)
Requires: /etc/redhat-release
Here's the full output:
docker build -t lambda-ruby2.5-postgresql10 .
Sending build context to Docker daemon 10.75kB
Step 1/6 : FROM lambci/lambda:build-ruby2.5
build-ruby2.5: Pulling from lambci/lambda
c10bc2510050: Pull complete
fa535c6d8b41: Pull complete
b17a5543c497: Pull complete
ff5b96d65dff: Pull complete
Digest: sha256:eb71bf94bc332928bdfd66868107cce7cbdf9ba9c361ce2d9e042352244d5a80
Status: Downloaded newer image for lambci/lambda:build-ruby2.5
---> 807020d3e4f6
Step 2/6 : RUN yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-redhat10-10-2.noarch.rpm
---> Running in b8f25f6964f0
Loaded plugins: ovl, priorities
Examining /var/tmp/yum-root-mDWiCr/pgdg-redhat10-10-2.noarch.rpm: pgdg-redhat-repo-42.0-5.noarch
Marking /var/tmp/yum-root-mDWiCr/pgdg-redhat10-10-2.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package pgdg-redhat-repo.noarch 0:42.0-5 will be installed
--> Processing Dependency: /etc/redhat-release for package: pgdg-redhat-repo-42.0-5.noarch
--> Processing Dependency: /etc/redhat-release for package: pgdg-redhat-repo-42.0-5.noarch
--> Finished Dependency Resolution
You could try using --skip-broken to work around the problem
Error: Package: pgdg-redhat-repo-42.0-5.noarch (/pgdg-redhat10-10-2.noarch)
Requires: /etc/redhat-release
You could try running: rpm -Va --nofiles --nodigest
The command '/bin/sh -c yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-redhat10-10-2.noarch.rpm' returned a non-zero code: 1
Hi! U did a really good job! Thanks a lot! ๐
But, how about mysql version of that script? ๐
just like an idea for next repo
I'm able to test the function locally with
make && make install && make test
Then I built the deploy.zip and deploy but when runnning on Lambda it still raises an error
aws lambda invoke \
--region ap-southeast-2 \
--function-name RubyLambdaPostgreSQLNokogiri /dev/stdout
{"errorMessage":"libpq.so.5: cannot open shared object file: No such file or directory - /var/task/vendor/bundle/ruby/2.5.0/gems/pg-1.2.2/lib/pg_ext.so","errorType":"Init<LoadError>","stackTrace":["/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'","/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'","/var/task/vendor/bundle/ruby/2.5.0/gems/pg-1.2.2/lib/pg.rb:5:in `<top (required)>'","/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:130:in `require'","/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:130:in `rescue in require'","/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:34:in `require'","/var/task/handler.rb:1:in `<top (required)>'","/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'","/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'"]}{
"FunctionError": "Unhandled",
"ExecutedVersion": "$LATEST",
"StatusCode": 200
}
Anyone has any idea on that?
Thank you
Hi,
Thank you for putting this up on github. It's exactly what I'm looking for.
I'm getting a load error when executing the lambda however.
Steps to recreate:
make && make test
See Travis build here: https://travis-ci.org/bethesque/lambda-ruby-pg-nokogiri/builds/520063477
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.