rubyonjets / jets

Ruby on Jets
http://rubyonjets.com
MIT License
2.6k stars 181 forks source link

Native Gems from darwin do not work #523

Closed jhottenstein closed 3 years ago

jhottenstein commented 3 years ago

Checklist

My Environment

Software Version
Operating System OS X 11.0.1
Jets 2.3.17
Ruby 2.5.8

I deploy directly from my machine


Expected Behaviour

Lambda functions do not crash at startup

Current Behavior

All lambda functions crash at startup

Step-by-step reproduction instructions

Run a more basic version of the quick start guide

gem install jets
jets new demo
cd demo
jets generate controller posts index
jets deploy
jets call posts-controller-index '{"test":1}' | jq
Calling lambda function demo-dev-posts_controller-index on AWS
Function name: demo-dev-posts_controller-index
Pro tip: The Lambda Console Link to the demo-dev-posts_controller-index function has been added to your clipboard.
{
  "errorMessage": "Could not find nokogiri-1.11.1-x86_64-darwin in any of the sources",
  "errorType": "Init<Bundler::GemNotFound>",
  "stackTrace": [
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/spec_set.rb:86:in `block in materialize'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in `map!'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in `materialize'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/definition.rb:170:in `specs'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/definition.rb:237:in `specs_for'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/definition.rb:226:in `requested_specs'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/runtime.rb:101:in `block in definition_method'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/runtime.rb:20:in `setup'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `block in <top (required)>'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in `with_level'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in `silence'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `<top (required)>'",
    "/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'",
    "/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'",
    "/var/task/handlers/controllers/posts_controller.rb:1:in `<top (required)>'",
    "/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:72:in `require'",
    "/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:72:in `require'"
  ]
}

I had to downgrade nokogiri to 1.10.x

jhottenstein commented 3 years ago

I see that 3.0.0 just dropped. I can try upgrading.

ryz310 commented 3 years ago

Same problem occurred to me with Jets 3.0.0. I have fixed it adding version lock for nokogiri.

# Gemfile
gem 'nokogiri', '~> 1.10.0'
tongueroo commented 3 years ago

@ryz310 Unsure what's going on there 🧐 Just tested it and was able to use the latest version of nokogiri.

Here's a simple test controller:

require 'open-uri'

class NokogiriController < ApplicationController
  def index
    # Fetch and parse HTML document
    doc = Nokogiri::HTML(URI.open('https://nokogiri.org/tutorials/installing_nokogiri.html'))

    # Search for nodes by css
    content = nil
    doc.css('nav ul.menu li a', 'article h2').each do |link|
      content = link.content
    end

    render json: {
      content: content,
      nokogiri_version: Nokogiri::VERSION,
      jets_version: Jets::VERSION,
      ruby_version: RUBY_VERSION,
    }
  end
end

Here's the debugging output from the Jets app on AWS Lambda.

$ curl https://ykmipzptqc.execute-api.us-west-2.amazonaws.com/dev/ ; echo
{"content":"Appendix A: The Compiler Toolchain¶","nokogiri_version":"1.11.1","jets_version":"3.0.0","ruby_version":"2.7.2"}
$ curl -s https://ykmipzptqc.execute-api.us-west-2.amazonaws.com/dev/ | jq
{
  "content": "Appendix A: The Compiler Toolchain¶",
  "nokogiri_version": "1.11.1",
  "jets_version": "3.0.0",
  "ruby_version": "2.7.2"
}
$

Code is also here: https://github.com/tongueroo/jets-nokogiri-demo

jhottenstein commented 3 years ago

Ah, thanks for the reply. I'll try it out. I was able to repro with just running the quick start (minus db code). I modified the original bug report.

jhottenstein commented 3 years ago

Your project gave me the same error:

$ curl https://szg6nfeohb.execute-api.us-east-1.amazonaws.com/dev/ ; echo
{"message": "Internal server error"}
$ jets call nokogiri-controller-index '{"test":1}'|jq
Calling lambda function nokogiri-dev-nokogiri_controller-index on AWS
Function name: nokogiri-dev-nokogiri_controller-index
Pro tip: The Lambda Console Link to the nokogiri-dev-nokogiri_controller-index function has been added to your clipboard.
{
  "errorMessage": "Could not find nokogiri-1.11.1 in any of the sources",
  "errorType": "Init<Bundler::GemNotFound>",
  "stackTrace": [
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/spec_set.rb:86:in `block in materialize'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in `map!'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/spec_set.rb:80:in `materialize'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/definition.rb:170:in `specs'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/definition.rb:237:in `specs_for'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/definition.rb:226:in `requested_specs'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/runtime.rb:101:in `block in definition_method'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/runtime.rb:20:in `setup'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `block in <top (required)>'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in `with_level'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in `silence'",
    "/var/runtime/gems/bundler-2.1.4/lib/bundler/setup.rb:20:in `<top (required)>'",
    "/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'",
    "/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:92:in `require'",
    "/var/task/handlers/controllers/nokogiri_controller.rb:1:in `<top (required)>'",
    "/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:72:in `require'",
    "/var/lang/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:72:in `require'"
  ]
}
Full deploy logs: ``` $ jets deploy Deploying to Lambda nokogiri-dev environment... Building CloudFormation templates. Generated CloudFormation templates at /tmp/jets/nokogiri/templates Deploying CloudFormation stack with jets app! Waiting for stack to complete 11:12:16AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack nokogiri-dev User Initiated 11:12:20AM CREATE_IN_PROGRESS AWS::S3::Bucket S3Bucket 11:12:21AM CREATE_IN_PROGRESS AWS::S3::Bucket S3Bucket Resource creation Initiated 11:12:42AM CREATE_COMPLETE AWS::S3::Bucket S3Bucket 11:12:43AM CREATE_COMPLETE AWS::CloudFormation::Stack nokogiri-dev Stack success status: CREATE_COMPLETE Time took for stack deployment: 31s. The jets version has changed enough since the last build to merit refreshing the build cache. Current jets version: 3.0.0 Last built jets version: unknown Removing /tmp/jets/nokogiri to start fresh. => Compling assets in current project directory => yarn install yarn install v1.22.4 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... warning " > postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@^1.0.30000697". warning " > webpack-dev-server@3.11.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0". warning "webpack-dev-server > webpack-dev-middleware@3.7.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0". [4/4] 🔨 Building fresh packages... ✨ Done in 9.27s. => JETS_ENV=development bin/webpack Hash: bf8104733f8829203ac7 Version: webpack 4.46.0 Time: 3073ms Built at: 01/11/2021 11:13:03 AM Asset Size Chunks Chunk Names css/theme-091f1fb2.css 252 bytes theme [emitted] [immutable] theme css/theme-091f1fb2.css.map 564 bytes theme [emitted] [dev] theme js/application-e1f775d69c4918a86720.js 318 KiB application [emitted] [immutable] application js/application-e1f775d69c4918a86720.js.map 375 KiB application [emitted] [dev] application js/theme-8d93dc0cc7011472ae21.js 3.93 KiB theme [emitted] [immutable] theme js/theme-8d93dc0cc7011472ae21.js.map 3.61 KiB theme [emitted] [dev] theme manifest.json 901 bytes [emitted] Entrypoint application = js/application-e1f775d69c4918a86720.js js/application-e1f775d69c4918a86720.js.map Entrypoint theme = css/theme-091f1fb2.css js/theme-8d93dc0cc7011472ae21.js css/theme-091f1fb2.css.map js/theme-8d93dc0cc7011472ae21.js.map [./app/javascript/packs/application.js] 872 bytes {application} [built] [./app/javascript/packs/theme.scss] 39 bytes {theme} [built] [./app/javascript/src/jets/crud.js] 2.24 KiB {application} [built] [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 552 bytes {application} [built] + 2 hidden modules Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-1!node_modules/postcss-loader/src/index.js??ref--6-2!node_modules/sass-loader/dist/cjs.js??ref--6-3!app/javascript/packs/theme.scss: Entrypoint mini-css-extract-plugin = * [./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/dist/cjs.js?!./app/javascript/packs/theme.scss] ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/javascript/packs/theme.scss 1.06 KiB {mini-css-extract-plugin} [built] + 1 hidden module => Copying current project directory to temporary build area: /tmp/jets/nokogiri/stage/code => Reconfiguring webpacker development settings for AWS Lambda. => Bundling: running bundle install in cache area: /tmp/jets/nokogiri/cache. => cd /tmp/jets/nokogiri/cache && env bundle install Fetching gem metadata from https://rubygems.org/...... Fetching rake 13.0.3 Installing rake 13.0.3 Fetching concurrent-ruby 1.1.7 Installing concurrent-ruby 1.1.7 Fetching i18n 1.8.7 Installing i18n 1.8.7 Fetching minitest 5.14.3 Installing minitest 5.14.3 Fetching tzinfo 2.0.4 Installing tzinfo 2.0.4 Fetching zeitwerk 2.4.2 Installing zeitwerk 2.4.2 Fetching activesupport 6.1.1 Installing activesupport 6.1.1 Fetching builder 3.2.4 Installing builder 3.2.4 Fetching erubi 1.10.0 Installing erubi 1.10.0 Fetching mini_portile2 2.5.0 Installing mini_portile2 2.5.0 Fetching racc 1.5.2 Installing racc 1.5.2 with native extensions Fetching nokogiri 1.11.1 (x86_64-darwin) Installing nokogiri 1.11.1 (x86_64-darwin) Fetching rails-dom-testing 2.0.3 Installing rails-dom-testing 2.0.3 Fetching crass 1.0.6 Installing crass 1.0.6 Fetching loofah 2.8.0 Installing loofah 2.8.0 Fetching rails-html-sanitizer 1.3.0 Installing rails-html-sanitizer 1.3.0 Fetching actionview 6.1.1 Installing actionview 6.1.1 Fetching rack 2.2.3 Installing rack 2.2.3 Fetching rack-test 1.1.0 Installing rack-test 1.1.0 Fetching actionpack 6.1.1 Installing actionpack 6.1.1 Fetching globalid 0.4.2 Installing globalid 0.4.2 Fetching activejob 6.1.1 Installing activejob 6.1.1 Fetching mini_mime 1.0.2 Installing mini_mime 1.0.2 Fetching mail 2.7.1 Installing mail 2.7.1 Fetching actionmailer 6.1.1 Installing actionmailer 6.1.1 Fetching activemodel 6.1.1 Installing activemodel 6.1.1 Fetching activerecord 6.1.1 Installing activerecord 6.1.1 Fetching aws-eventstream 1.1.0 Installing aws-eventstream 1.1.0 Fetching aws-partitions 1.415.0 Installing aws-partitions 1.415.0 Fetching aws-sigv4 1.2.2 Installing aws-sigv4 1.2.2 Fetching jmespath 1.4.0 Installing jmespath 1.4.0 Fetching aws-sdk-core 3.110.0 Installing aws-sdk-core 3.110.0 Fetching aws_config 0.1.0 Installing aws_config 0.1.0 Fetching memoist 0.16.2 Installing memoist 0.16.2 Fetching rainbow 3.0.0 Installing rainbow 3.0.0 Fetching thor 1.0.1 Installing thor 1.0.1 Fetching aws-mfa-secure 0.4.3 Installing aws-mfa-secure 0.4.3 Fetching aws-sdk-apigateway 1.58.0 Installing aws-sdk-apigateway 1.58.0 Fetching aws-sdk-cloudformation 1.46.0 Installing aws-sdk-cloudformation 1.46.0 Fetching aws-sdk-cloudwatchlogs 1.38.0 Installing aws-sdk-cloudwatchlogs 1.38.0 Fetching aws-sdk-dynamodb 1.58.0 Installing aws-sdk-dynamodb 1.58.0 Fetching aws-sdk-kinesis 1.30.0 Installing aws-sdk-kinesis 1.30.0 Fetching aws-sdk-kms 1.40.0 Installing aws-sdk-kms 1.40.0 Fetching aws-sdk-lambda 1.57.0 Installing aws-sdk-lambda 1.57.0 Fetching aws-sdk-s3 1.87.0 Installing aws-sdk-s3 1.87.0 Fetching aws-sdk-sns 1.36.0 Installing aws-sdk-sns 1.36.0 Fetching aws-sdk-sqs 1.35.0 Installing aws-sdk-sqs 1.35.0 Fetching aws-sdk-ssm 1.101.0 Installing aws-sdk-ssm 1.101.0 Using bundler 2.1.4 Fetching cfn-status 0.4.2 Installing cfn-status 0.4.2 Fetching cfn_camelizer 0.4.9 Installing cfn_camelizer 0.4.9 Fetching cfn_response 0.2.0 Installing cfn_response 0.2.0 Fetching dotenv 2.7.6 Installing dotenv 2.7.6 Fetching dynomite 1.2.6 Installing dynomite 1.2.6 Fetching gems 1.2.0 Installing gems 1.2.0 Fetching hashie 4.1.0 Installing hashie 4.1.0 Fetching rack-proxy 0.6.5 Installing rack-proxy 0.6.5 Fetching method_source 1.0.0 Installing method_source 1.0.0 Fetching railties 6.1.1 Installing railties 6.1.1 Fetching semantic_range 2.3.1 Installing semantic_range 2.3.1 Fetching jetpacker 0.5.0 Installing jetpacker 0.5.0 Fetching jets-html-sanitizer 1.0.4 Installing jets-html-sanitizer 1.0.4 Fetching rexml 3.2.4 Installing rexml 3.2.4 Fetching kramdown 2.3.0 Installing kramdown 2.3.0 Fetching mimemagic 0.3.5 Installing mimemagic 0.3.5 Fetching recursive-open-struct 1.1.3 Installing recursive-open-struct 1.1.3 Fetching serverlessgems 0.1.0 Installing serverlessgems 0.1.0 Fetching shotgun 0.9.2 Installing shotgun 0.9.2 Fetching text-table 1.2.4 Installing text-table 1.2.4 Fetching jets 3.0.0 Installing jets 3.0.0 Fetching mysql2 0.5.3 Installing mysql2 0.5.3 with native extensions Bundle complete! 11 Gemfile dependencies, 71 gems now installed. Gems in the groups development and test were not installed. Bundled gems are installed into `./vendor/gems` Post-install message from i18n: HEADS UP! i18n 1.1 changed fallbacks to exclude default locale. But that may break your application. If you are upgrading your Rails application from an older version of Rails: Please check your Rails app for 'config.i18n.fallbacks = true'. If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be 'config.i18n.fallbacks = [I18n.default_locale]'. If not, fallbacks will be broken in your app by I18n 1.1.x. If you are starting a NEW Rails application, you can ignore this notice. For more info see: https://github.com/svenfuchs/i18n/releases/tag/v1.1.0 Bundle install success. Tidying project: removing ignored files to reduce package size. => rsync -a --links /tmp/jets/nokogiri/stage/code/vendor/gems/ruby/2.5.0/ /tmp/jets/nokogiri/stage/opt/ruby/gems/2.5.0/ => Replacing compiled gems with AWS Lambda Linux compiled versions: /tmp/jets/nokogiri/stage/opt Checking projects gems for binary Lambda gems... ERROR: Limit Reached You have reached your daily anonymous download limit. You can increase the limit by registering: https://www.serverlessgems.com/rate-limits Registering increases your rate limit. Once you get a token, you can configure your machine with: jets configure TOKEN Note: Replace TOKEN with your actual token. $ # I added a token $ jets deploy Deploying to Lambda nokogiri-dev environment... The /tmp/jets/nokogiri/cache folder exists. Incrementally re-building the jets using the cache. To clear the cache: rm -rf /tmp/jets/nokogiri/cache => Compling assets in current project directory => yarn install yarn install v1.22.4 [1/4] 🔍 Resolving packages... success Already up-to-date. ✨ Done in 0.58s. => JETS_ENV=development bin/webpack Hash: bf8104733f8829203ac7 Version: webpack 4.46.0 Time: 1397ms Built at: 01/11/2021 11:20:44 AM Asset Size Chunks Chunk Names css/theme-091f1fb2.css 252 bytes theme [emitted] [immutable] theme css/theme-091f1fb2.css.map 564 bytes theme [emitted] [dev] theme js/application-e1f775d69c4918a86720.js 318 KiB application [emitted] [immutable] application js/application-e1f775d69c4918a86720.js.map 375 KiB application [emitted] [dev] application js/theme-8d93dc0cc7011472ae21.js 3.93 KiB theme [emitted] [immutable] theme js/theme-8d93dc0cc7011472ae21.js.map 3.61 KiB theme [emitted] [dev] theme manifest.json 901 bytes [emitted] Entrypoint application = js/application-e1f775d69c4918a86720.js js/application-e1f775d69c4918a86720.js.map Entrypoint theme = css/theme-091f1fb2.css js/theme-8d93dc0cc7011472ae21.js css/theme-091f1fb2.css.map js/theme-8d93dc0cc7011472ae21.js.map [./app/javascript/packs/application.js] 872 bytes {application} [built] [./app/javascript/packs/theme.scss] 39 bytes {theme} [built] [./app/javascript/src/jets/crud.js] 2.24 KiB {application} [built] [./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 552 bytes {application} [built] + 2 hidden modules Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js??ref--6-1!node_modules/postcss-loader/src/index.js??ref--6-2!node_modules/sass-loader/dist/cjs.js??ref--6-3!app/javascript/packs/theme.scss: Entrypoint mini-css-extract-plugin = * [./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/dist/cjs.js?!./app/javascript/packs/theme.scss] ./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/javascript/packs/theme.scss 1.06 KiB {mini-css-extract-plugin} [built] + 1 hidden module => Copying current project directory to temporary build area: /tmp/jets/nokogiri/stage/code => Reconfiguring webpacker development settings for AWS Lambda. => Bundling: running bundle install in cache area: /tmp/jets/nokogiri/cache. => cd /tmp/jets/nokogiri/cache && env bundle install Using rake 13.0.3 Using concurrent-ruby 1.1.7 Using i18n 1.8.7 Using minitest 5.14.3 Using tzinfo 2.0.4 Using zeitwerk 2.4.2 Using activesupport 6.1.1 Using builder 3.2.4 Using erubi 1.10.0 Using mini_portile2 2.5.0 Using racc 1.5.2 Using nokogiri 1.11.1 (x86_64-darwin) Using rails-dom-testing 2.0.3 Using crass 1.0.6 Using loofah 2.8.0 Using rails-html-sanitizer 1.3.0 Using actionview 6.1.1 Using rack 2.2.3 Using rack-test 1.1.0 Using actionpack 6.1.1 Using globalid 0.4.2 Using activejob 6.1.1 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailer 6.1.1 Using activemodel 6.1.1 Using activerecord 6.1.1 Using aws-eventstream 1.1.0 Using aws-partitions 1.415.0 Using aws-sigv4 1.2.2 Using jmespath 1.4.0 Using aws-sdk-core 3.110.0 Using aws_config 0.1.0 Using memoist 0.16.2 Using rainbow 3.0.0 Using thor 1.0.1 Using aws-mfa-secure 0.4.3 Using aws-sdk-apigateway 1.58.0 Using aws-sdk-cloudformation 1.46.0 Using aws-sdk-cloudwatchlogs 1.38.0 Using aws-sdk-dynamodb 1.58.0 Using aws-sdk-kinesis 1.30.0 Using aws-sdk-kms 1.40.0 Using aws-sdk-lambda 1.57.0 Using aws-sdk-s3 1.87.0 Using aws-sdk-sns 1.36.0 Using aws-sdk-sqs 1.35.0 Using aws-sdk-ssm 1.101.0 Using bundler 2.1.4 Using cfn-status 0.4.2 Using cfn_camelizer 0.4.9 Using cfn_response 0.2.0 Using dotenv 2.7.6 Using dynomite 1.2.6 Using gems 1.2.0 Using hashie 4.1.0 Using rack-proxy 0.6.5 Using method_source 1.0.0 Using railties 6.1.1 Using semantic_range 2.3.1 Using jetpacker 0.5.0 Using jets-html-sanitizer 1.0.4 Using rexml 3.2.4 Using kramdown 2.3.0 Using mimemagic 0.3.5 Using recursive-open-struct 1.1.3 Using serverlessgems 0.1.0 Using shotgun 0.9.2 Using text-table 1.2.4 Using jets 3.0.0 Using mysql2 0.5.3 Bundle complete! 11 Gemfile dependencies, 71 gems now installed. Gems in the groups development and test were not installed. Bundled gems are installed into `./vendor/gems` Bundle install success. Tidying project: removing ignored files to reduce package size. => rsync -a --links /tmp/jets/nokogiri/stage/code/vendor/gems/ruby/2.5.0/ /tmp/jets/nokogiri/stage/opt/ruby/gems/2.5.0/ => Replacing compiled gems with AWS Lambda Linux compiled versions: /tmp/jets/nokogiri/stage/opt Checking projects gems for binary Lambda gems... => Generating shims in the handlers folder. => Creating zip file for /tmp/jets/nokogiri/stage/opt => cd /tmp/jets/nokogiri/stage/opt && zip --symlinks -rq opt.zip . Zip file created at: /tmp/jets/nokogiri/stage/zips/opt-01dc7260.zip (22.2 MB) => Creating zip file for /tmp/jets/nokogiri/stage/code => cd /tmp/jets/nokogiri/stage/code && zip --symlinks -rq code.zip . Zip file created at: /tmp/jets/nokogiri/stage/zips/code-891ded52.zip (157 KB) Building CloudFormation templates. Generated CloudFormation templates at /tmp/jets/nokogiri/templates Uploading CloudFormation templates to S3. Uploading code zip files to S3. Uploading /tmp/jets/nokogiri/stage/zips/opt-01dc7260.zip (22.2 MB) to S3 Uploaded to s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/code/opt-01dc7260.zip Time to upload code to s3: 4s Uploading /tmp/jets/nokogiri/stage/zips/code-891ded52.zip (157 KB) to S3 Uploaded to s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/code/code-891ded52.zip Time to upload code to s3: 0s Checking for modified public assets and uploading to S3. Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/404.html Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/index.html Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/500.html Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/favicon.ico Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/422.html Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/packs/css/theme-091f1fb2.css.map Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/packs/css/theme-091f1fb2.css Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/packs/js/theme-8d93dc0cc7011472ae21.js.map Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/packs/js/theme-8d93dc0cc7011472ae21.js Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/packs/js/application-e1f775d69c4918a86720.js Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/packs/manifest.json Uploading and setting content type for s3://nokogiri-dev-s3bucket-16100aiab26dj/jets/public/packs/js/application-e1f775d69c4918a86720.js.map Time for public assets to s3: 1s Deploying CloudFormation stack with jets app! Waiting for stack to complete 11:21:30AM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack nokogiri-dev User Initiated 11:21:35AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack ApiGateway 11:21:35AM CREATE_IN_PROGRESS AWS::IAM::Role IamRole 11:21:35AM CREATE_IN_PROGRESS AWS::Lambda::LayerVersion GemLayer 11:21:36AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack ApiGateway Resource creation Initiated 11:21:36AM CREATE_IN_PROGRESS AWS::IAM::Role IamRole Resource creation Initiated 11:21:44AM CREATE_IN_PROGRESS AWS::Lambda::LayerVersion GemLayer Resource creation Initiated 11:21:45AM CREATE_COMPLETE AWS::Lambda::LayerVersion GemLayer 11:21:46AM CREATE_COMPLETE AWS::CloudFormation::Stack ApiGateway 11:21:49AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack ApiResources1 11:21:49AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack ApiResources1 Resource creation Initiated 11:21:56AM CREATE_COMPLETE AWS::IAM::Role IamRole 11:21:58AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack JetsPreheatJob 11:21:58AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack NokogiriController 11:21:59AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack JetsPreheatJob Resource creation Initiated 11:21:59AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack NokogiriController Resource creation Initiated 11:22:00AM CREATE_COMPLETE AWS::CloudFormation::Stack ApiResources1 11:22:02AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack JetsPublicController 11:22:04AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack JetsPublicController Resource creation Initiated 11:22:33AM CREATE_COMPLETE AWS::CloudFormation::Stack NokogiriController 11:22:38AM CREATE_COMPLETE AWS::CloudFormation::Stack JetsPublicController 11:22:40AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack ApiDeployment20210111112122 11:22:41AM CREATE_IN_PROGRESS AWS::CloudFormation::Stack ApiDeployment20210111112122 Resource creation Initiated 11:22:52AM CREATE_COMPLETE AWS::CloudFormation::Stack ApiDeployment20210111112122 11:23:54AM CREATE_COMPLETE AWS::CloudFormation::Stack JetsPreheatJob 11:23:56AM UPDATE_COMPLETE_CLEANUP_IN_PROGRESS AWS::CloudFormation::Stack nokogiri-dev 11:23:56AM UPDATE_COMPLETE AWS::CloudFormation::Stack nokogiri-dev Stack success status: UPDATE_COMPLETE Time took for stack deployment: 2m 31s. Prewarming application. API Gateway Endpoint: https://szg6nfeohb.execute-api.us-east-1.amazonaws.com/dev/ [jhottenstein@hottenmac jets-nokogiri-demo (master)]$ curl https://szg6nfeohb.execute-api.us-east-1.amazonaws.com/dev/ ; echo {"message": "Internal server error"} [jhottenstein@hottenmac jets-nokogiri-demo (master)]$ curl https://ykmipzptqc.execute-api.us-west-2.amazonaws.com/dev/ ; echo {"content":"Appendix A: The Compiler Toolchain¶","nokogiri_version":"1.11.1","jets_version":"3.0.0","ruby_version":"2.5.8"} [jhottenstein@hottenmac jets-nokogiri-demo (master)]$ ```

Gem layer: I believe the issue is that nokogiri-1.11.1-x86_64-darwin is in the gem directory.

dev-nokogiri-gems-fb588aaa-6e4b-49ca-9dfa-d070575e6975.zip

tongueroo commented 3 years ago

That was a tough one. Seems like ruby and/or bundler changed the way gems can be installed, which changes the way native gem detection works. Fixed. Try upgrading to jets v3.0.2 and then:

rm -rf /tmp/jets
jets deploy
KaitakuShiba commented 3 years ago

In my case, when I fixed the version to 1.9.1 to avoid using nokogiri's 1.11, I got an error related to liblzma, so I fixed it to 1.10 and that solved the problem.If you're having same trouble, please refer to the following.

liblzma.so.5: cannot open shared object file: No such file or directory - /opt/ruby/gems/2.7.0/gems/nokogiri-1.9.1/lib/nokogiri/nokogiri.so
- gem 'nokogiri', '1.9.1'

+ gem 'nokogiri', '~> 1.10.0'
tongueroo commented 3 years ago

Had to do with gem detection and specific versions of nokogiri gem. Fixed in #529 It was already fixed in Jets v3. Also, released in jets v2.3.19.