Can't deploy basic API

Hello. Today I discovered Jets (and it looked great to me, thanks for developing it and amazing docs) and I wanted to try it out.
When deploying a very basic API app with no additional gems (just what was scaffolded ) I got

=> Replacing compiled gems with AWS Lambda Linux compiled versions: /tmp/jets/pinpoint-hibob/stage/opt
Checking project for compiled gems...
Your project requires compiled gems that are not currently available.  Unavailable precompiled gems:

* Unavailable: racc-1.7.3 Available versions: 

* Unavailable: date-3.3.4 Available versions: 

* Unavailable: bigdecimal-3.1.6 Available versions: 

* Unavailable: byebug-11.1.3 Available versions: 

* Unavailable: nio4r-2.7.0 Available versions: 

* Unavailable: puma-6.4.2 Available versions: 

* Unavailable: nokogiri-1.16.2 Available versions: 

Your current Jets API endpoint: https://api.rubyonjets.com/v1

When I enter https://api.rubyonjets.com/v1 I see 404: " The page you were looking for doesn’t exist.".
The same for https://api.serverlessgems.com/api/v1

image

Can you please suggest how I can fix it?
Thank in advance

Bummer. Unsure why it reports the gems missing. Just tried a fresh cloud9 machine and a demo jets app deployed successfully.

jets deploy
$ jets deploy
Deploying stack demo-dev ...
The /tmp/jets/demo/cache folder exists. Incrementally re-building the jets using the cache.  To clear the cache: rm -rf /tmp/jets/demo/cache
=> jets assets:precompile
=> Copying current project directory to temporary build area: /tmp/jets/demo/stage/code
=> Bundling: running bundle install in cache area: /tmp/jets/demo/cache.
=> cd /tmp/jets/demo/cache && env bundle install
Bundle complete! 9 Gemfile dependencies, 78 gems now installed.
Gems in the groups 'development' and 'test' were not installed.
Bundled gems are installed into `./vendor/gems`
Bundle install completed
Tidying project: removing ignored files to reduce package size.
=> rsync -a --links /tmp/jets/demo/stage/code/vendor/gems/ruby/3.2.0/ /tmp/jets/demo/stage/opt/ruby/gems/3.2.0/
=> Replacing compiled gems with AWS Lambda Linux compiled versions: /tmp/jets/demo/stage/opt
Checking project for compiled gems...
=> Generating shims in the handlers folder.
Checking s3://demo-dev-s3bucket-ibihfxuz4ozj/jets/code/opt-db9f3862.zip
Already exists: s3://demo-dev-s3bucket-ibihfxuz4ozj/jets/code/opt-db9f3862.zip
Checking s3://demo-dev-s3bucket-ibihfxuz4ozj/jets/code/code-d2ba2484.zip
Already exists: s3://demo-dev-s3bucket-ibihfxuz4ozj/jets/code/code-d2ba2484.zip
Building CloudFormation templates
Built CloudFormation templates at /tmp/jets/demo/templates
Uploading CloudFormation templates to S3.
Uploading code zip files to S3.
Checking for modified public assets and uploading to S3.
Time for public assets to s3: 0s
Deploying CloudFormation stack with jets app!
Waiting for stack to complete
10:22:49PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack demo-dev User Initiated
10:22:52PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack ApiGateway 
10:22:53PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack JetsPreheatJob 
10:22:53PM UPDATE_COMPLETE AWS::CloudFormation::Stack ApiGateway 
10:22:53PM UPDATE_COMPLETE AWS::CloudFormation::Stack JetsPreheatJob 
10:22:53PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack JetsController 
10:22:53PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack ApiResources1 
10:22:54PM UPDATE_COMPLETE AWS::CloudFormation::Stack JetsController 
10:22:54PM UPDATE_COMPLETE AWS::CloudFormation::Stack ApiResources1 
10:22:55PM UPDATE_IN_PROGRESS AWS::CloudFormation::Stack ApiMethods1 
10:22:55PM UPDATE_COMPLETE AWS::CloudFormation::Stack ApiMethods1 
10:22:56PM CREATE_IN_PROGRESS AWS::CloudFormation::Stack ApiDeployment20240225222249 
10:22:56PM CREATE_IN_PROGRESS AWS::CloudFormation::Stack ApiDeployment20240225222249 Resource creation Initiated
10:23:07PM CREATE_COMPLETE AWS::CloudFormation::Stack ApiDeployment20240225222249 
10:23:08PM UPDATE_COMPLETE_CLEANUP_IN_PROGRESS AWS::CloudFormation::Stack demo-dev 
10:23:09PM DELETE_IN_PROGRESS AWS::CloudFormation::Stack ApiDeployment20240225221905 
10:23:09PM UPDATE_COMPLETE AWS::CloudFormation::Stack JetsPreheatJob 
10:23:20PM DELETE_COMPLETE AWS::CloudFormation::Stack ApiDeployment20240225221905 
10:23:20PM UPDATE_COMPLETE AWS::CloudFormation::Stack ApiMethods1 
10:23:21PM UPDATE_COMPLETE AWS::CloudFormation::Stack ApiResources1 
10:23:21PM UPDATE_COMPLETE AWS::CloudFormation::Stack JetsController 
10:23:21PM UPDATE_COMPLETE AWS::CloudFormation::Stack ApiGateway 
10:23:21PM UPDATE_COMPLETE AWS::CloudFormation::Stack demo-dev 
Stack success status: UPDATE_COMPLETE
Time took: 35s
Prewarming application.
API Gateway Endpoint: https://kq1smw5yx3.execute-api.us-west-2.amazonaws.com/dev/
Release version: 8
$ 

Also checked some gems and their versions as a sanity check:

$ bundle info puma
  * puma (6.4.2)
        Summary: Puma is a simple, fast, threaded, and highly parallel HTTP 1.1 server for Ruby/Rack applications
        Homepage: https://puma.io
        Source Code: https://github.com/puma/puma
        Changelog: https://github.com/puma/puma/blob/master/History.md
        Bug Tracker: https://github.com/puma/puma/issues
        Path: /home/ubuntu/.rvm/gems/ruby-3.2.2/gems/puma-6.4.2
$ bundle info date
  * date (3.3.4)
        Summary: A subclass of Object includes Comparable module for handling dates.
        Homepage: https://github.com/ruby/date
        Path: /home/ubuntu/.rvm/gems/ruby-3.2.2/gems/date-3.3.4
        Reverse Dependencies: 
                net-imap (0.4.10) depends on date (>= 0)
$ bundle info racc
  * racc (1.7.3)
        Summary: Racc is a LALR(1) parser generator
        Homepage: https://github.com/ruby/racc
        Path: /home/ubuntu/.rvm/gems/ruby-3.2.2/gems/racc-1.7.3
        Reverse Dependencies: 
                nokogiri (1.16.2) depends on racc (~> 1.4)
$ 

FWIW, the next version, Jets 6, will not use precompiled gems.

Jets 6 will be a very big update and would recommend waiting for that if possible. Thinking it’ll be about 2 months. That’s a guess.

I am having this same problem when trying to follow your guide to create an API lol
And then I get an OpenSSL error. My https://api.rubyonjets.com/v1 returns ok though

Your project requires compiled gems that are not currently available.  Unavailable precompiled gems:

* Unavailable: racc-1.7.3 Available versions:

* Unavailable: nokogiri-1.16.4 Available versions:

* Unavailable: date-3.3.4 Available versions:

* Unavailable: byebug-11.1.3 Available versions:

* Unavailable: mysql2-0.5.6 Available versions:

* Unavailable: nio4r-2.7.1 Available versions:

* Unavailable: puma-6.4.2 Available versions:

Your current Jets API endpoint: https://api.rubyonjets.com/v1

Jets is unable to build a deployment package that will work on AWS Lambda without the required precompiled gems.
To remedy this, you can:

* Use another gem that does not require compilation.
* Create your own custom layer with the gem: http://rubyonjets.com/docs/extras/custom-lambda-layers/
* No need to report this to us, as we've already been notified.
* Usually, missing gems can be built within a few minutes.
* Some gems may take days or even longer.

Compiled gems usually take some time to figure out how to build as they each depend on different libraries and packages.
More info: https://docs.rubyonjets.com/docs/pro/

#<Thread:0x000000010f35c590 /Users/carolinaborges/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/jets-api-0.2.0/lib/jets/api/gems/report.rb:14 run> terminated with exception (report_on_exception is true):
/Users/carolinaborges/.rbenv/versions/3.1.4/lib/ruby/3.1.0/openssl/ssl.rb:145:in `options=': can't modify frozen OpenSSL::SSL::SSLContext: #<OpenSSL::SSL::SSLContext:0x000000010f33d118 @verify_mode=1, @verify_hostname=true, @max_proto_version=nil, @min_proto_version=769, @cert_store=#<OpenSSL::X509::Store:0x0000000104b2f0c0 @verify_callback=nil, @error=nil, @error_string=nil, @chain=nil, @time=nil>, @session_new_cb=#<Proc:0x000000010f33cb28 /Users/carolinaborges/.rbenv/versions/3.1.4/lib/ruby/3.1.0/net/http.rb:1061>> (FrozenError)

Any thoughts?

Bummer. Unsure. One thing I noticed is that you have Ruby 3.1. Believe AWS Lambda only supports 3.2. Try using asdf or rbenv so you can switch to 3.2

Also, a heads up. Jets 6.0 is close to release. It’s less than a month out.

It’ll be a major game changer. Pretty much completely changes the way Jets works. I would wait for that if possible. No sweat either way.

it is just a poc to see if Ruby on jets is worth it, not a big deal… If I decided to use in our application, I will surely wait for 6.0. Btw I tried to change for Ruvy 3.2.0 and now I have a different error

Ignoring debug-1.7.1 because its extensions are not built. Try: gem pristine debug --version 1.7.1
Ignoring rbs-2.8.2 because its extensions are not built. Try: gem pristine rbs --version 2.8.2
Ignoring debug-1.7.1 because its extensions are not built. Try: gem pristine debug --version 1.7.1
Ignoring rbs-2.8.2 because its extensions are not built. Try: gem pristine rbs --version 2.8.2
/Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:135:in `require': cannot load such file -- /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets/authorizer (LoadError)
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:135:in `const_get'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:135:in `cget'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:182:in `block in actual_eager_load_dir'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:40:in `block in ls'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:25:in `each'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/helpers.rb:25:in `ls'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:170:in `actual_eager_load_dir'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:17:in `block (2 levels) in eager_load'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:16:in `each'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:16:in `block in eager_load'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:10:in `synchronize'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/zeitwerk-2.6.13/lib/zeitwerk/loader/eager_load.rb:10:in `eager_load'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets.rb:29:in `<top (required)>'
	from <internal:/Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/exe/jets:4:in `<top (required)>'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/bin/jets:25:in `load'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/bin/jets:25:in `<main>'
carolinaborges in ~/Projects/msa-tf-configure on carolinas/MSA-127 ● λ gem pristin

tried change the version of zeitwerk, tried installing the authorizer gem and nothing worked. Any thoughts?

new error now

Stack success status: UPDATE_COMPLETE
Prewarming application.
#<Thread:0x000000010da17878 /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets/preheat.rb:35 run> terminated with exception (report_on_exception is true):
/Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets/commands/call/caller.rb:78:in `remote_run': undefined method `read' for nil:NilClass (NoMethodError)

      result = resp.payload.read # already been normalized/JSON.dump by AWS
                           ^^^^^
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets/commands/call/caller.rb:31:in `run'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets/preheat.rb:27:in `warm'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets/preheat.rb:36:in `block (2 levels) in warm_all'
/Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets/commands/call/caller.rb:78:in `remote_run': undefined method `read' for nil:NilClass (NoMethodError)

      result = resp.payload.read # already been normalized/JSON.dump by AWS
                           ^^^^^
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets/commands/call/caller.rb:31:in `run'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets/preheat.rb:27:in `warm'
	from /Users/carolinaborges/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/jets-5.0.12/lib/jets/preheat.rb:36:in `block (2 levels) in warm_all

this error is something I should worry about? btw the error above I fixed using bundle exec jets deploy instead of jets deploy :woman_shrugging:t2:

RE: undefined method `read’ for nil:NilClass (NoMethodError)

It’s a bug. It doesn’t really cause any harm but is pretty confusing for users. Fixed in fix prewarming post deploy by tongueroo · Pull Request #723 · rubyonjets/jets · GitHub Thanks for the report.

RE: If I decided to use in our application, I will surely wait for 6.0.

Yes. Jets 6 is so much different than previous versions it’s surely worth waiting. Excited and trying not to let cat out of the bag. Let’s just say it’s a game changer :smile:

1 Like