`relation "action_text_rich_texts" does not exist` in CircleCI
Published 8th January 2020 at 05:50pm UTC (Last Updated 14th April 2020 at 06:38pm UTC)
Another short post about obscure errors. Ran into this weirdness yesterday/this morning:
rake aborted! ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "action_text_rich_texts" does not exist LINE 8: WHERE a.attrelid = '"action_text_rich_texts"'::regclass
Just came out of nowhere.
Everything I found online seemed to suggest that I simply needed to run the relevant migration or install ActionText again...
And that's perfectly reasonable when the error occurs in the dev environment. Sadly, this didn't work when I ran it here...
It's worth noting that at this point I already had a working CircleCI config and had already successfully run tests even after I'd added an ActionText::RichText column to an earlier table.
I tried experimenting with the rake tasks I'd already added in .circleci/config.yml but the error still wouldn't budge.
I was almost at my wit's end when I found the post below:
require 'factory_girl_rails' - https://discuss.circleci.com/t/pg-undefinedtable-error-relation-users-does-not-exist/4250
The post is a little old so when Nesokas refers to "factorygirl", they're actually referring to the factory_bot_rails gem (Thoughtbot changed the name - it was a whole thing). Following those instructions fixed the error message.
So in short, if you see that error, add
gem 'rspec-rails', '~> 4.0.0.beta2'
to your Gemfile, run the following in the terminal:
Add the this to spec/rails_helper.rb:
And then push it to your branch
git add -A git commit -m "Fix CircleCI error" git push origin HEAD
The error should clear up in no time!
Anyway, props to Nesokas for working this out as it's a bizarre error to get and the solution is far from obvious. I would link to their social media but I can't really find them anywhere else so... ¯\_(ツ)_/¯
Posted by Anonymous on 27th July 2020 at 16:51:56 UTC