elixir-error-tracker / error-tracker

🐛 An Elixir-based built-in error reporting and tracking solution
https://hex.pm/packages/error_tracker
Apache License 2.0
331 stars 14 forks source link

Error reporting always uses "public" prefix #93

Closed gmile closed 6 days ago

gmile commented 6 days ago

I've create a migration and specified a dedicated DB schema (prefix) to keep error-tracker tables separately from my app's tables. However, upon doing so, it appears that error reporting uses default error prefix "public" and I am failing to find a way to configure the prefix for the reporting 🤔

In my migration, I had this:

defmodule AiPlayground.Repo.Migrations.AddErrorTracker do
  use Ecto.Migration

  def up, do: ErrorTracker.Migration.up(version: 3, prefix: "error_tracker")
  def down, do: ErrorTracker.Migration.down(version: 1, prefix: "error_tracker")
end

And when I force an exception, I get this report in the log:

[error] Handler ErrorTracker.Integrations.Phoenix has failed and has been detached. Class=:error
Reason=%Postgrex.Error{
  message: nil,
  postgres: %{
    code: :undefined_table,
    line: "1363",
    message: "relation \"public.error_tracker_errors\" does not exist",
    position: "25",
    file: "parse_relation.c",
    unknown: "ERROR",
    severity: "ERROR",
    pg_code: "42P01",
    routine: "parserOpenTable"
  },
  connection_id: 35097,
  query: "SELECT e0.\"status\" FROM \"public\".\"error_tracker_errors\" AS e0 WHERE (e0.\"fingerprint\" = $1)"
}

I omitted full stack trace for brevity, but it has only these lines related to ErrorTracker:

{ErrorTracker, :upsert_error!, 4, [file: ~c"lib/error_tracker.ex", line: 219]},
{ErrorTracker, :report, 3, [file: ~c"lib/error_tracker.ex", line: 117]},
odarriba commented 6 days ago

Hello!

have you added the prefix to the application configuration?

config :error_tracker, :prefix, "error_tracker"

(It is specified in here for future reference)

gmile commented 6 days ago

@odarriba I skimmed the docs a few times yet somehow managed to completely miss that configuration flag 🤦 Thanks for pointing it out!