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

Custom :json_library breaks deps.compile: "module is not available or is yet to be defined" #532

Closed
ftes opened this issue Jan 21, 2021 · 2 comments

Comments

@ftes
Copy link

ftes commented Jan 21, 2021

How to reproduce

  1. Create and configure a custom :json_library.
defmodule MyJasonDecorator do
  def encode_to_iodata!(input), do: Jason.encode_to_iodata!(input)
  def decode!(iodata), do: Jason.decode!(iodata)
end
# config.exs
config :postgrex, :json_library, MyJasonDecorator
  1. Run mix deps.compile postgrex --force
MyJasonDecorator.encode_to_iodata!/1 is undefined (module MyJasonDecorator. is not available or is yet to be defined)

References

In the end the answer is you can’t (relyably). The only thing causing order between dependencies is the dependency tree. The only thing making anything compile before postgrex is postgrex depending on it (even if it’s an optional dependency). Given the only json library postgrex depends on is jason the option to configure it is essentially useless. I’d open an issue in postgrex about the compile time usage for the json_library config.

@josevalim
Copy link
Member

Thanks! Btw, is it a warning or is it a compilation error?

@ftes
Copy link
Author

ftes commented Jan 21, 2021

Its a warning.

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