Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Protocol.UndefinedError) protocol Jason.Encoder not implemented #113

Open
ZombieHarvester opened this issue Apr 21, 2020 · 1 comment
Open

Comments

@ZombieHarvester
Copy link

When I tried to use ScoutAPM in dev env following the instruction from ReadMe, i'm getting the following error when I start the app. Phoenix version 1.4.16

** (exit) an exception was raised:
    ** (Protocol.UndefinedError) protocol Jason.Encoder not implemented for %ScoutApm.Payload.Metadata{agent_pid: 16608, agent_time: "2020-04-21T09:26:10.701350Z", agent_version: "1.0.6", app_root: "/Users/*******", language: "elixir", language_version: "1.10.2", payload_version: 1, platform: "elixir", platform_version: "1.10.2", unique_id: "an3e4bqsGNsyhWeHQRIh"} of type ScoutApm.Payload.Metadata (a struct), Jason.Encoder protocol must always be explicitly implemented.

If you own the struct, you can derive the implementation specifying which fields should be encoded to JSON:

    @derive {Jason.Encoder, only: [....]}
    defstruct ...

It is also possible to encode all fields, although this should be used carefully to avoid accidentally leaking private information when new fields are added:

    @derive Jason.Encoder
    defstruct ...
@antondomratchev
Copy link

I recently ran into this exact issue. I was able to resolve this by setting dev_trace config to false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants