-
Notifications
You must be signed in to change notification settings - Fork 143
Ruby Layers not properly packaged #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I ran into the same issue today. The only way I was able to get the above workaround to work on SAM 1.24.0 was to adjust the above Makefile with: RUBY_VERSION = 2.7.0
mkfile_path := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
build-MakeBuildLayer:
bundle install --path=$(mkfile_path)
rm -rf $(mkfile_path)/ruby/$(RUBY_VERSION)/cache && rm -rf $(mkfile_path)/ruby/$(RUBY_VERSION)/bin
mkdir -p $(mkfile_path)/ruby/gems
mv $(mkfile_path)/ruby/$(RUBY_VERSION) $(mkfile_path)/ruby/gems Otherwise, it would package up the ContentUri and nothing would be there. |
+1 here for those who need some postgres (pg gem) love...based on @davegallant and @jkahn117 's work above
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
When using SAM to build a Ruby layer, packaging of Gems is incorrect. Gems are bundled in
ruby /lib/vendor/bundle/ruby/2.7.0
using the default bundler workflow, these Gems are not picked up by the runtime.Per documentation,
GEM_PATH
(ruby/gems/2.7.0
) should be used. Shared / custom code is packaged properly toRUBYLIB
(ruby/lib
).Steps to reproduce the issue:
SAMBuild
containing aGemfile
with valid contents.sam build
command.Observed result:
Result of build (
.aws-sam/build
) containsSAMBuildLayer/ruby/lib/vendor/bundle/ruby/2.7.0/gems
with bundled Gems. When attempting to run sample function, Gem is not found.Expected result:
Gem should be packaged in
ruby/gems/2.7.0
and available to function when executed. I was able to build using a Makefile:And Makefile in
MakeBuild
directory:Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
SAM CLI, version 0.52.0
The text was updated successfully, but these errors were encountered: