Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Ruby Layers not properly packaged

オープン
#177 コメント 3 件 リアクション 5 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
aws, ruby

調査の方向性

SAMBuildLayer の例、その Gemfile、および sam build を使って問題を再現し、その後 .aws-sam/build を調べて、結果として生成された layer のレイアウトを確認します。バンドルされた gem を、ドキュメントに記載されているパス ruby/gems/2.7.0 および ruby/lib と比較します。サンプル関数が Makefile の回避策なしで Gem を見つけられれば完了です。

索引モデルが issue の本文から書いたものです。

説明

area/workflow/ruby_bundler maintainer/need-response

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:

  1. Create new SAM application.
  2. Add Layer to template:
SAMBuildLayer:
    Type: AWS::Serverless::LayerVersion
    Properties:
      ContentUri: SAMBuild
      CompatibleRuntimes:
        - ruby2.7
    Metadata:
      BuildMethod: ruby2.7
  1. Add directory SAMBuild containing a Gemfile with valid contents.
  2. Run sam build command.
  3. 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

主要言語
Python
スター
381
フォーク
164
平均マージ
1日 1時間
マージ済み PR(30日)
2

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aws/aws-lambda-builders のほかの issue

aws/aws-lambda-builders の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。