lamby: Unable to run my app or the cookiecutter... getting error `materialize': Could not find

Hi

I have been trying to launch my own app on to lambda and also the cookiecutter but after deploying to AWS I am getting the same error -

/usr/local/lib/ruby/3.2.0/bundler/definition.rb:524:in materialize’: Could not find debug-1.8.0, webrick-1.8.1, web-console-4.2.0, capybara-3.39.1, selenium-webdriver-4.9.1, webdrivers-5.2.0, irb-1.6.4, reline-0.3.4, bindex-0.8.1, addressable-2.8.4, matrix-0.4.2, nokogiri-1.15.2-aarch64-linux, regexp_parser-2.8.0, xpath-3.2.0, rexml-3.2.5, rubyzip-2.3.2, websocket-1.2.9, nio4r-2.5.9, websocket-driver-0.7.5, public_suffix-5.0.1 in locally installed gems (Bundler::GemNotFound)`

For some reason it seems like it cannot find the gems.

Does anyone know the fix / why this is happening?

Cheers Liam

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 18 (10 by maintainers)

Most upvoted comments

I could also add the automation to deploy via codebuild using GHA as a trigger if anyone is interested in that.

Yup, but be careful. I find that CI/CD is a very personal thing. One method I tried was to find something that works for the cookiecutter starter, anything, and just go with that. Then document this area is a personal choice. Make it easy to know where the Lamby rack adapter fits in, and where the rest is CI/CD boiler plate.

I was able to get past this issue (although ran into another issue unrelated) by bundling in a docker container because we need the gems bundled for Linux.

Created a new Dockerfile and called it Dockerfile.bundle

FROM ruby:3.2-bullseye

# Set working directory
WORKDIR /var/task

# Copy Gemfile and Gemfile.lock
COPY Gemfile Gemfile.lock ./

# Install dependencies
RUN bundle install --path vendor/bundle

Updated deploy script with:

echo '== Bundle For Deployment =='
docker build -t bundle-container -f Dockerfile.bundle .
docker run --rm -v $(pwd):/var/task bundle-container sh -c "\
bundle config --global silence_root_warning true && \
bundle config --local deployment true && \
bundle config --local path './vendor/bundle' && \
bundle install --quiet --jobs 4"

Always fine to ask, happy to help.

I think the issue is “platform” not “arch”. Your deployment target “platform” is going to be Linux. If your project has any gems with platform dependencies then you may be compiling gems that are executable and linking on your Mac, not Linux. So let’s say you have the MySQL2 gem? And when you vendor that on your Mac it will only run on your Mac and likely links shared objects (system dependences) only present on your Mac. This is why a dev container in both CI/CD is so helpful. Does that help?

missed those details; will dive into it thanks alot for your reply!