Skip to content

Field Occurrence.breadcrumbs is broken for MySQL/MariaDB #150

Open
@phihos

Description

@phihos

Describe the bug

Hey folks, I recently upgraded from v0.3.0 to v0.6.0 and the detail page of any error crashed with

** (ArgumentError) cannot load `"[]"` as type {:array, :string} for field :breadcrumbs in %ErrorTracker.Occurrence{__meta__: #Ecto.Schema.Metadata<:loaded, "error_tracker_occurrences">, id: nil, reason: nil, context: nil, breadcrumbs: nil, stacktrace: nil, error_id: nil, error: #Ecto.Association.NotLoaded<association :error is not loaded>, inserted_at: nil}

I already debugged this and it seems that the Ecto adapter Ecto.Adapters.MyXQL correctly stores arrays (like "[]" for an empty array), but crashes on retrieval.
I think there are two hints that we can not make this work just by configuration:

  1. I was not able to find documentation on how to make type :array work with MyXQL. The closest thing I found was this entry in the docs that describes how to store type :map in a JSON column. But no word about :array.
  2. When looking at the MyXQL source we see no implementation for def loaders(:array, type)....

In order to fix this I propose implementing a custom type. I already implemented a proposal that I will show in a PR soon.

To Reproduce

Steps to reproduce the behavior:

  1. Configure a MySQL/MariaDB db as storage backend.
  2. Generate some error.
  3. Try to navigate to the error detail page (like /errors/1).
  4. Internal server error.

Expected behavior

Detail page should not crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions