-
Notifications
You must be signed in to change notification settings - Fork 11
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
Production Release: Function Mix.Compilers.ApplicationTracer.trace/2 is undefined #3
Comments
In the Elixir forum Jose Valim kindly took it's time to evaluate this issue, and he have given me this reponse:
|
Hey, I checked the TypeIt.Progress it works as well. To adapt to Domo v1.2.0
It seems that you going to import struct's data from JSON. In this case, you can execute This version v1.2.0 can increase project compilation times to approximately 25% because it resolves all types at compile time and generates code. Please, evaluate how it works for you. If you have a code base with many structures I'll be glad to get to know how compilation times are changed, you can email me at |
You may want to clarify this to be like suggested in the error
|
You may want to add a third step:
I am now curious to know the reason behind the need to explicitly require now the typed struct, do you mind to briefly explain? |
I use Domo to type structs that I often use as default values in Ecto schemas, but that is not possible to do anymore:
The module: defmodule Tasks.Todos.TodoType do
use Domo
use TypedStruct
typedstruct do
field :type, :professional | :personal
field :title, String.t()
end
def default(), do: new(type: :professional, title: "Professional")
end Ecto schema: schema "todos" do
field :title, :string, null: false
field :description, :string, default: nil
field :type, :map, default: Tasks.Todos.TodoType.default()
timestamps()
end I understand why, because by this time the So, this will be a limitation of the current approach or can I do it differently? |
The Domo library
Steps to reproduce:
Now visit http://localhost:4000 and you will see the error. |
Hey,
That's the limitation of the current approach. The generated
Thanks, let's see what can be done. |
Turns out that after adding the following line to
And the Same time, the Phoenix hot code reload doesn't work for these type ensurer modules completely. Meaning that if one modifies the structure's fields they need to rerun Currently, domo type ensurer modules recompile each time when project compilation runs. Let's see what can be done to address these. |
If we are already using |
It seems that Phoenix doesn't respect |
The updated version https://hex.pm/packages/domo/1.2.1 has the full support of Phoenix hot-reload. Please, update the name of the compiler from
and do Now you can start the server with After change of the type in the struct or in any level deep dependant struct, Phoenix hot-reloads the module with updated |
It seems that is now working properly. You can try it by yourself at https://taskit.exadra37.com Thanks for your work and fixes :) Can I buy you a coffee? |
Do you want to add the button the repo or send me a link to pay you a coffee? https://ko-fi.com/ or maybe just enable Github Sponsors? |
Hey, thanks. I'm very glad that the library working for you! |
Proof of Concept
https://github.com/Exadra37/elixir-library-domo-bug
Environment
I run it in development and in production with the docker image from the Phoenix releases docs:
https://hexdocs.pm/phoenix/releases.html#containers
Versions used to build the docker image:
Actual behavior
The error from a production release:
The Typed Struct code:
Expected behavior
In production is throwing the reported error that crashes the app, but in development it works ok.
The text was updated successfully, but these errors were encountered: