-
Notifications
You must be signed in to change notification settings - Fork 529
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
import_types breaking change #937
Comments
I have experienced the same regression. |
Does anyone have a minimal reproduction case? |
This seems to be working for me at the moment on 1.5.5 EDIT: I take that back |
This was tracked down by @maartenvanvliet in #1022 ! I've published |
@binaryseed I am getting a similar variant to this issue in 1.6.3, my current setup works fine in 1.5.x: Could not load module `Elixir.ApolloWeb.Schema.PostTypes`. It returned reason: `unavailable`.
I know for sure the module exists... I am not using the tuple layout as above just straight importing the types one after the other |
Can you share more context? When does that happen? Can you generate a small reproduction case? |
I can replicate this in our app (not sure about a small / sharable repo), upgrading from On a full build, I will get an "unavailable" module error like above; which has a union type. If I replace the union type with a simple object of the same name (just an Oddly, if I do the full build with the dummy object, then replace with the union for subsequent (app only) compilation, it'll work. |
Can confirm, we're facing a similar issue. Just tried upgrading absinthe from
After a bit of debugging, we found that the issue may be related to imports. For example, this does not work: defmodule MyApp.GraphQL.Schema.AccountsSchema do
use Absinthe.Notation
import MyApp.GraphQL.Dataloader
# ...
object :user do
# ...
field :posts, list_of(:post), resolve: dataloader(Post)
end
# ...
end But changing it to alias, does: defmodule MyApp.GraphQL.Schema.AccountsSchema do
use Absinthe.Notation
alias MyApp.GraphQL.Dataloader
# ...
object :user do
# ...
field :posts, list_of(:post), resolve: Dataloader.dataloader(Post)
end
# ...
end |
The unavailable error means there is a deadlock when trying to resolve the modules. Probably due to cyclic dependencies between the several Absinthe schemas. More info here: https://hexdocs.pm/elixir/Code.html#ensure_compiled/1 I believe Absinthe has a module that resolves the types at runtime instead of compilation time. Is this correct? If so, consider using that instead, as that should fix compile-time deadlocks. |
@josevalim yeah the default in the next release is to resolve everything at runtime and load it into |
* Better solve deadlocks on Elixir v1.12+ Closes #937. * Update type_imports.ex * Silence dialyzer error Co-authored-by: José Valim <jose.valim@plataformatec.com.br>
Environment
Expected behavior
imports types from MyApp.Schema.Types.Users and from MyApp.Schema.Types.Posts.
Absinthe 1.4.16 works fine with this kind of import
Actual behavior
^
works correctly
The text was updated successfully, but these errors were encountered: