Issue
After a jets deploy
, on AWS Lambda if you see this error:
"errorMessage": "Could not find timeout-0.3.1 in any of the sources",
"errorType": "Init<Bundler::GemNotFound>"
TLDR
Fix by updating bundler with:
gem install --default bundler
gem update --system
bundle update --bundler
And deploying again
jets deploy
Details
So this was a rabbit hole
It looks like the Ruby team and matz himself is moving the Timeout class out of ruby core to a separate gem https://github.com/ruby/timeout This is probably an effort to improve the Timeout logic independent from ruby core.
Over the years, sometimes have seen when core logic is move out of Ruby Core to gems, bundler and Ruby are not in sync and thereโs issue installing the โmovedโ gem. Vaguely remember seeing something like this with I think byebug and json.
In any case, found that upgrading bundler
fixes the issue.
How It Was Tested
On a brand new cloud9 machine, rvm install 2.7.7
happens to have bundler 2.1.4 installed by default - this reproduces the issue.
$ gem list bundler
bundler (default: 2.1.4)
Built a demo app and deployed it:
# setup from fresh cloud9 machine
rvm install 2.7.7
rvm --default use 2.7.7
npm install -g c9
npm install -g yarn
sudo yum install mariadb-devel -y # for mysql2 gem dev headers
Then deployed the app
jets new demo
cd demo
jets deploy
Would then see this error on AWS Lambda
"errorMessage": "Could not find timeout-0.3.1 in any of the sources",
"errorType": "Init<Bundler::GemNotFound>"
Fix by Updating Bundler
To update bundler
gem install --default bundler
gem update --system
bundle update --bundler
Thanks! Rails: How to change Bundler default version - Stack Overflow
Then deployed again and the demo app works on AWS Lambda
More Debugging Notes
Was able to figure out what was going on by bundling within the /tmp/jets/demo/cache
folder where the gems built for deployment. The specific bundler option that seem to be causing issues is BUNDLE_PATH: "vendor/gems"
in the .bundle/config
setting.
Before with old bundler 2.1.4
tung:/tmp/jets/demo/cache $ bundle info timeout
Could not find timeout-0.3.1 in locally installed gems
tung:/tmp/jets/demo/cache $ ls vendor/gems/ruby/2.7.0/gems/ | grep timeout
After with upgraded bundler 2.3.26
tung:/tmp/jets/demo/cache $ bundle info timeout
* timeout (0.3.1)
Summary: Auto-terminate potentially long-running operations in Ruby.
Homepage: https://github.com/ruby/timeout
Path: /tmp/jets/demo/cache/vendor/gems/ruby/2.7.0/gems/timeout-0.3.1
tung:/tmp/jets/demo/cache $ ls vendor/gems/ruby/2.7.0/gems/ | grep timeout
timeout-0.3.1
tung:/tmp/jets/demo/cache $
So think this may be a related to the ruby timeout library moving out of Ruby Core and old versions of bundler not yet accounting for that.
Additional Thoughts
Added a check as part of jets deploy and fail early. Instead of users finding out by the time itโs on AWS Lambda https://github.com/boltops-tools/jets/pull/641