I tried to force the use of compiled gems (via bundle config set force_ruby_platform true). This fixed the gem directory but added the wrong platform for the extensions:
I encountered the same issue, probably with nokogiri (1.11.1-x86_64-darwin). It is quite painful to debug too because Custom::BasePathMapping hangs up the cloudformation stack and it takes up to an hour for it to release the stack. The jets-base-path lambda has recurring errors.
{
"errorMessage": "Could not find nokogiri-1.11.1 in any of the sources",
"errorType": "Init<Bundler::GemNotFound>",
"stackTrace": [
"/var/runtime/gems/bundler-2.2.5/lib/bundler/spec_set.rb:87:in `block in materialize'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/spec_set.rb:81:in `map!'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/spec_set.rb:81:in `materialize'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/definition.rb:175:in `specs'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/definition.rb:245:in `specs_for'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/definition.rb:227:in `requested_specs'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/runtime.rb:91:in `block in definition_method'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/runtime.rb:20:in `setup'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler.rb:148:in `setup'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/setup.rb:20:in `block in <top (required)>'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/ui/shell.rb:136:in `with_level'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/ui/shell.rb:88:in `silence'",
"/var/runtime/gems/bundler-2.2.5/lib/bundler/setup.rb:20:in `<top (required)>'",
"/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'",
"/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'",
"/var/task/handlers/functions/jets/base_path.rb:1:in `<top (required)>'",
"/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'",
"/var/lang/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:85:in `require'"
]
}
Hi, could you elaborate more on how to build a custom lambda layer with gem 'nokogiri', '~> 1.11.1'? Perhaps link on how to go about doing this? Thanks.