I had an issue where the recently added “Check SKIP_DB_AND_REDIS bootability” step failed for one of my plugins.
SKIP_DB_AND_REDIS boot failed. Make sure the database is not being accessed during the Rails boot process.
To reproduce locally, run `SKIP_DB_AND_REDIS=1 RAILS_DB=‘nonexistent’ bin/rails runner “puts ‘booted successfully’”`.
I tried that, but I could not reproduce the problem locally. It just passed.
I could use the stack trace of the failing github action step to nail down what code was the culprit.
The offending code
In one of my controllers I declared a constant which retrieved the list of attributes of an active record:
REWARD_FIELDS = Reward.attribute_names.excluding("id", "created_at", "updated_at")
Which you apparently should not do.
But it would have been nicer if I could simulate this check locally, so I do not have to doe some trial an error via github actions. So there must be something else besides executing:
SKIP_DB_AND_REDIS=1 RAILS_DB='nonexistent' bin/rails runner "puts 'booted successfully'"
david
(David Taylor)
June 8, 2026, 3:09pm
3
Interesting, thanks for reporting!
That’s quite a specific thing, which we probably didn’t consider before.
Could you try changing this line to false on your local install:
And then try the reproduction command again?
If that successfully reproduces the problem, then we should look at adding an ENV to control that schema_cache_dump setting.
That had no effect. Neither did deleting the db/schema_cache.yml file.
david
(David Taylor)
June 9, 2026, 6:08pm
7
Please could you try these two:
Development mode, using different env to set database:
SKIP_DB_AND_REDIS=1 DISCOURSE_DEV_DB=‘nonexistent’ bin/rails runner “puts ‘booted successfully’”
In test mode, with plugins loaded:
LOAD_PLUGINS=1 RAILS_ENV=test SKIP_DB_AND_REDIS=1 RAILS_DB=‘nonexistent’ bin/rails runner “puts ‘booted successfully’”
Nope, still successful.
Just to verify that the plugin code is loaded I used “puts DiscourseKofi::Engine.to_s” and it printed the name. But when I referenced the class which would create a database connection “puts DiscourseKofi::Admin::AccountsController.to_s” it finally failed.
So it looks like it does not fully load the plugin code locally as it does in the Github Action.
The full failing command:
LOAD_PLUGINS=1 SKIP_DB_AND_REDIS=1 DISCOURSE_DEV_DB=nonexistent bin/rails runner "puts DiscourseKofi::Admin::AccountsController.to_s"
without LOAD_PLUGINS=1 or using RAILS_DB=nonexistent did not result in a failure
Correction, LOAD_PLUGINS didn’t matter.
So, this will fail:
SKIP_DB_AND_REDIS=1 DISCOURSE_DEV_DB=nonexistent bin/rails runner "puts DiscourseKofi::Admin::AccountsController.to_s"
-> failure
This did not:
SKIP_DB_AND_REDIS=1 DISCOURSE_DEV_DB=nonexistent bin/rails runner "puts 'booted successfully'"
-> no failure
Neither did referencing a class which would not reach out to the DB:
SKIP_DB_AND_REDIS=1 DISCOURSE_DEV_DB=nonexistent bin/rails runner "puts DiscourseKofi::Admin::PaymentsController.to_s"
-> no failure