Question

Gem not found error when deploying monorepo to App Platform

Hi,

I am using App Platform to deploy a Ruby on Rails API backend. Rails version : 7.0.2 Ruby version : 3.1.1

When I deploy my backend on App Platform both build and deploy phase are working properly.

I am switching to a monorepo where I have two folders : /frontend and /backend.

I created a new App on App platform by setting the source directory to /backend.

Then, the build phase worked well.

But when the deploy phase starts I get this error :

[2022-03-31 08:46:55] /usr/lib/ruby/2.5.0/rubygems/dependency.rb:310:in `to_specs': Could not find 'racc' (~> 1.4) among 176 total gem(s) (Gem::MissingSpecError)
[2022-03-31 08:46:55] Checked in 'GEM_PATH=/layers/heroku_ruby/gems/vendor/bundle/ruby/3.1.0:/workspace/.gem/ruby/2.5.0:/var/lib/gems/2.5.0:/usr/lib/x86_64-linux-gnu/rubygems-integration/2.5.0:/usr/share/rubygems-integration/2.5.0:/usr/share/rubygems-integration/all', execute `gem env` for more information
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1469:in `block in activate_dependencies'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `each'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `activate_dependencies'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1440:in `activate'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1472:in `block in activate_dependencies'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `each'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `activate_dependencies'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1440:in `activate'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1472:in `block in activate_dependencies'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `each'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `activate_dependencies'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1440:in `activate'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1472:in `block in activate_dependencies'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `each'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `activate_dependencies'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1440:in `activate'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1472:in `block in activate_dependencies'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `each'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1458:in `activate_dependencies'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems/specification.rb:1440:in `activate'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems.rb:310:in `block in activate_bin_path'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems.rb:309:in `synchronize'
[2022-03-31 08:46:55]   from /usr/lib/ruby/2.5.0/rubygems.rb:309:in `activate_bin_path'
[2022-03-31 08:46:55]   from /layers/heroku_ruby/gems/vendor/bundle/ruby/3.1.0/bin/rails:25:in `<main>'

The build command is

rails server -p $PORT -e ${RAILS_ENV:-production}

Thanks a lot for your help,

Adrien

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi Adrien,

I think your environment variables are not corrects. You can check out:

$ gem env

What versions of Ruby are you installed?

$ rvm list

You should check what version you have in the file .ruby-version and specify this version by default.

rvm use --default 3.1.1

Finally, Why your GEM_PATH point to /layers/heroku_ruby ?

I wait you tell me something :)

Best regards,

Sergio Turpín