Open CR1AT0RS opened 4 years ago
Commenting out these in schema.rb resolves the issue:
# create_table "exception_hunter_error_groups", force: :cascade do |t|
# t.string "error_class_name", null: false
# t.string "message"
# t.integer "status", default: 0
# t.text "tags", default: [], array: true
# t.datetime "created_at", precision: 6, null: false
# t.datetime "updated_at", precision: 6, null: false
# t.index ["message"], name: "index_exception_hunter_error_groups_on_message", opclass: :gin_trgm_ops, using: :gin
# t.index ["status"], name: "index_exception_hunter_error_groups_on_status"
# end
# create_table "exception_hunter_errors", force: :cascade do |t|
# t.string "class_name", null: false
# t.string "message"
# t.datetime "occurred_at", null: false
# t.json "environment_data"
# t.json "custom_data"
# t.json "user_data"
# t.string "backtrace", default: [], array: true
# t.bigint "error_group_id"
# t.datetime "created_at", precision: 6, null: false
# t.datetime "updated_at", precision: 6, null: false
# t.index ["error_group_id"], name: "index_exception_hunter_errors_on_error_group_id"
# end
# add_foreign_key "exception_hunter_errors", "exception_hunter_error_groups", column: "error_group_id"
Hey @CR1AT0RS, thanks for reporting this issue!. It doesn't seem to be related to the gem itself but rather to Postgres. Exception Hunter uses the pg_trgm module from Postgres to quickly index error messages and search them by similarity (kind of like Elasticsearch does).
This module should be installed by default but it may not be present on your system, could you tell me which operating system are you using, Postgres' version, and how did you install it?
You can also check for instructions to enable the module in this issue, it seems you only need to run CREATE EXTENSION pg_trgm;
inside a psql
session.
@brunvez thanks for responding.
I have the extensions enabled. I am using OSX postgres.app which comes precompiled with the extensions. I am on rails 6.0.3 and ruby 2.7.1. Interestingly if I run the migrations manually to create a new schema it works but when I use the default "apartment" based migration creation it faiils.
This works:
t.index :message, using: :gin
This doesn't work:
t.index :message, opclass: :gin_trgm_ops, using: :gin
Migration name: 20200716171440_create_exception_hunter_error_groups.rb
class CreateExceptionHunterErrorGroups < ActiveRecord::Migration[6.0]
def change
enable_extension :pg_trgm
create_table :exception_hunter_error_groups do |t|
t.string :error_class_name, null: false
t.string :message
t.integer :status, default: 0
t.text :tags, array: true, default: []
t.timestamps
t.index :message, opclass: :gin_trgm_ops, using: :gin
t.index :status
end
end
end
Bug report:
from /Users/narya/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:92:in `async_exec' Caused by PG::UndefinedObject: ERROR: operator class "gin_trgm_ops" does not exist for access method "gin"
from /Users/narya/.rvm/gems/ruby-2.7.1/gems/activerecord-6.0.3.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:92:in `async_exec'