Ruby Layers not properly packaged
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- aws, ruby
- Domain
- build-system, cloud
Research direction
Reproduce the issue with the SAMBuildLayer example, its Gemfile, and sam build, then inspect .aws-sam/build for the resulting layer layout. Compare the bundled gems with the documented ruby/gems/2.7.0 and ruby/lib paths; done means a sample function can find the Gem without the Makefile workaround.
Written by the indexing model from the issue text.
Description
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 to RUBYLIB (ruby/lib).
Steps to reproduce the issue:
- Create new SAM application.
- Add Layer to template:
SAMBuildLayer:
Type: AWS::Serverless::LayerVersion
Properties:
ContentUri: SAMBuild
CompatibleRuntimes:
- ruby2.7
Metadata:
BuildMethod: ruby2.7
- Add directory
SAMBuildcontaining aGemfilewith valid contents. - Run
sam buildcommand. - Review results and/or test with a sample function.
Observed result:
Result of build (.aws-sam/build) contains SAMBuildLayer/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:
MakeBuildLayer:
Type: AWS::Serverless::LayerVersion
Properties:
ContentUri: MakeBuild
CompatibleRuntimes:
- ruby2.7
Metadata:
BuildMethod: makefile
And Makefile in MakeBuild directory:
build-MakeBuildLayer:
bundle install --path=$(ARTIFACTS_DIR)
rm -rf $(ARTIFACTS_DIR)/ruby/2.7.0/cache && rm -rf $(ARTIFACTS_DIR)/ruby/2.7.0/bin
mkdir $(ARTIFACTS_DIR)/ruby/gems
mv $(ARTIFACTS_DIR)/ruby/2.7.0 $(ARTIFACTS_DIR)/ruby/gems
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
SAM CLI, version 0.52.0
- Dominant language
- Python
- Stars
- 381
- Forks
- 164
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/aws-lambda-builders
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
aws/aws-lambda-builders#925 · 1 reaction ·
Maintainers usually reply within 2 days
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
aws/aws-lambda-builders#933 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 64/100
aws/aws-lambda-builders#924 · 1 comment · 1 reaction ·
Maintainers usually reply within 2 days
-
Bug: PythonUvBuilder fails to build app with dependencies on editable installs in the workspaceOpenstage/needs-triage
Difficulty 3/5 1-2 days Newbie friendliness 25/100
aws/aws-lambda-builders#892 ·
Maintainers usually reply within 2 days
-
stage/needs-triage type/feature
Difficulty 4/5 3-5 days Newbie friendliness 38/100
aws/aws-lambda-builders#839 · 2 comments · 1 reaction ·
Maintainers usually reply within 2 days
All issues in aws/aws-lambda-builders
Similar issues
-
namespace operations
Difficulty 1/5 Under an hour Newbie friendliness 82/100
EclipseFdn/open-vsx.org#13573 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
collective/icalendar#1854 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rancher/rancher-ai-agent#412 ·
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
TUDelftGeodesy/DePSI#134 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HenriquesLab/rxiv-maker#335 ·