Chitra
Chitra

Reputation: 1404

how to resolve native gem dependencies for AWS Lambda function?

I am using serverless framework with 'aws-ruby' template. In my Gemfile i have pg and nokogiri gem.

When I run 'bundle install --deployment', it actually creates a vendor folder in my current working directory and also build the dependency based on my local system environment.

I am having issue related to native extension error on AWS environment when i run my lambda function.

Any idea how can i resolve the native dependencies of ruby gems on AWS lambda environment?

Upvotes: 1

Views: 605

Answers (1)

appplemac
appplemac

Reputation: 382

A pattern I’m seeing quite a lot is to build your function and its dependencies in a Docker container based on Amazon Linux (e.g. that OS that your function will be running on in Lambda): check out this blog post for a walkthrough and some examples.

Another example project is here.

Upvotes: 2

Related Questions