Unable to setup database on github actions with RAILS 6/ruby 3 undefined method `hooks'

We’re running a RAILS 6.1.4.1 with ruby 3.0.2.
Our database is restored through a structure.sql.
VMs are running on Ubuntu latest stable version (18.04 is also failing).

The following command is failing with undefined method `hooks’

RAILS_ENV=test bin/rails db:drop && bin/rails db:create && bin/rails db:structure:load && bin/rails db:test:prepare

No luck with a simpler one
RAILS_ENV=test bin/rails db:setup

Everything goes fine locally (if we don’t forget to run bin/rails db:test:prepare).

Failure Logs

NoMethodError: undefined method `hooks’ for nil:NilClass

38/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/forest_liana-6.6.2/lib/forest_liana/bootstrapper.rb:61:in `block (2 levels) in generate_action_hooks’

39/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/forest_liana-6.6.2/lib/forest_liana/bootstrapper.rb:***8:in `each’

40/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/forest_liana-6.6.2/lib/forest_liana/bootstrapper.rb:***8:in `block in generate_action_hooks’

41/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/forest_liana-6.6.2/lib/forest_liana/bootstrapper.rb:***7:in `each’

42/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/forest_liana-6.6.2/lib/forest_liana/bootstrapper.rb:***7:in `generate_action_hooks’

43/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/forest_liana-6.6.2/lib/forest_liana/bootstrapper.rb:84:in `generate_apimap’

44/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/.0.0/gems/forest_liana-6.6.2/lib/forest_liana/bootstrapper.rb::in `initialize’

45/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/forest_liana-6.6.2/lib/forest_liana/engine.rb:88:in `new’

46/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/forest_liana-6.6.2/lib/forest_liana/engine.rb:88:in `block in class:Engine

47/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/activesupport-6.1.4.1/lib/active_support/lazy_load_hooks.rb:68:in `block in execute_hook’

48/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/activesupport-6.1.4.1/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control’

49/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/activesupport-6.1.4.1/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook’

50/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/activesupport-6.1.4.1/lib/active_support/lazy_load_hooks.rb:***2:in `block in run_load_hooks’

51/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/activesupport-6.1.4.1/lib/active_support/lazy_load_hooks.rb:***1:in `each’

52/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/activesupport-6.1.4.1/lib/active_support/lazy_load_hooks.rb:***1:in `run_load_hooks’

53/home/runner/work/okarito-api/okarito-api/vendor/bundle/ruby/***.0.0/gems/railties-6.1.4.1/lib/rails/application/finisher.rb:140:in `block in module:Finisher

54

Context

See on top of post:

  • Database Dialect: Postgresql
  • Database Version: 11.x

Hello @yld,

Thanks for sharing those informations.

  • Did it worked on the past for previous Ubuntu version or previous forest_liana version ? :eyes:

  • I see that you use forest_liana version 6.6.2 can you upgrade to version 6.6.3 or upgrade to major 7 ?

EDIT: The following thread had the same issue. We should release a fix soon. [Rails] After upgrade to 7.2.2 / NoMethodError: undefined method `actions' for nil:NilClass / Heroku Review apps - #24 by jeffladiray

Another question, do you use the Devise gem in your application ?

I will keep you updated once fixed.

Regards,
Morgan

1 Like

We’ve got the same behaviour with Ubuntu 18.04 and Ubuntu latest.

i’ll update it once again Forest to 6.6.3. Version 7 has some breaking changes we need to update before proceeding.

Yes we do.

Everything worked fine with ruby 2.7, so i suspect this is the ruby version bump that trigger this error.
And yes we did upgrade some other gems.

1 Like

Same problem with Forest 6.6.3.

Hey @yld,

Thanks for your answer. Indeed we have an issue with Devise gem.

Indeed, sorry you can encounter the same issue with v7 too.

Interesting insight, we don’t know what cause the issue with Devise but it can be worth looking at this.

Do you use the latest version of Devise ?

Regards,

Yes, we’re using devise 4.8.0

1 Like

I will give you some news next week on this subject. If everything goes well we should release a fix. :slight_smile:

Any update regarding this bug?

Hello @yld,

Sorry for the delay, a new version of the forest_liana gem (forest_liana 7.4.1) has been released with a fix.

Can you upgrade to this version ? :pray:

Tell me if it fixes the issue for you.

Kind regards,
Morgan

Upgrading to the latest Forest version (and modifying all the smart actions) solved our problem.
Thanks.