I dove into generating Absinthe schemas programmatically and I was able to get things working (see Errors programmatically generating Absinthe input objects (InputObjectTypeDefinition))
However, we are sometimes seeing :persistent_term
errors… this same error was dogging me as I worked through the mechanics of how to generate and append the new input-objects, but I thought I had worked out the kinks. When our Github workflows run to build a release, we override the release
command with an alias so we can do a few additional tasks, including generating an SDL file like mix absinthe.schema.sdl --schema MyAppWeb.GraphQLSchema priv/path/to/schema.graphql
. And that release
command is failing in the Github workflow. Running mix phx.server
is also causing problems for other developers on our team when they have pulled down the branch with the automatic schema generation. The errors are like this:
** (ArgumentError) errors were found at the given arguments:
* 1st argument: no persistent term stored with this key
:persistent_term.get({Absinthe.Schema.PersistentTerm, JesterWeb.GraphQLSchema})
(absinthe 1.7.0) lib/absinthe/schema/persistent_term.ex:94: Absinthe.Schema.PersistentTerm.get/1
Warning: (absinthe 1.7.0) lib/absinthe/schema/persistent_term.ex:54: Absinthe.Schema.PersistentTerm.__absinthe_type__/2
(absinthe 1.7.0) lib/absinthe/phase/schema.ex:107: Absinthe.Phase.Schema.set_schema_node/4
Warning: (absinthe 1.7.0) lib/absinthe/phase/schema.ex:71: anonymous fn/4 in Absinthe.Phase.Schema.set_children/3
(absinthe 1.7.0) lib/absinthe/blueprint/transform.ex:16: anonymous fn/3 in Absinthe.Blueprint.Transform.prewalk/2
Warning: (absinthe 1.7.0) lib/absinthe/blueprint/transform.ex:109: Absinthe.Blueprint.Transform.walk/4
(elixir 1.13.4) lib/enum.ex:1715: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
Error: Process completed with exit code 1.
I’m confused because I’ve been able to run this normally – e.g. deleting the deps
and _build
directories, I’ve been able to re-compile the same branch and I don’t get the error, leaving me in bad place of having a possible intermittent error that I can’t reproduce.
Other devs on our team have reported that removing the @schema_provider Absinthe.Schema.PersistentTerm
line from our schema caused things to work (I haven’t tried pushing that up to Github actions yet), but I’m wondering if:
- is there any way to get a more informative error? Which specific schema/field/argument was problematic?
- is there a possibility of a “poisoned cache?” Where the
_build
directory contains old BEAM files compiled BEFORE the switch to automatically generated schemas could cause errors when we checkout the branch with the new auto-generated schemas (and the@schema_provider Absinthe.Schema.PersistentTerm
)? - is there anything that might explain what could be an intermittent error? Is there anything that might explain the behavior we’re seeing?
Any insights or suggestions welcome!