-
Notifications
You must be signed in to change notification settings - Fork 17
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
Don't unshim middleware if they aren't shimmed to begin with #94
Conversation
Hi @jeffutter, thank you for the PR! I used your sample schema in one of my local projects that uses multiple middleware, but I wasn't able to reproduce the error you mentioned. What does the query body look like when you get this error? @kdawgwilk calling the expert here; do you have any suggestions about how we can go about testing this? |
Hey. Thanks for the quick response! The query looks something like this: query {
_entities(representations: [{__typename: "NamedEntity", name: "John"}]) {
... on NamedEntity {
name
... on Person {
age
}
}
}
} I'm pretty stumped as to how our application is different than what I can write in unit tests. My best guess is we're adding a middleware somewhere that somehow messes with the |
Hmm I am getting the following response for that with the schema you posted, and no errors: {
"data": {
"_entities": [
{
"age": 20,
"name": "John"
}
]
}
} What absinthe/absinthe_federation/elixir versions are you on? |
@kzlsakal I figured it out! :-D It happens on Schemas with Perhaps there's a better way to address it though? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kzlsakal I figured it out! :-D
It happens on Schemas with
@schema_provider Absinthe.Schema.PersistentTerm
. I've included a failing test that is fixed with the change I made.Perhaps there's a better way to address it though?
Brilliant! Thanks for uncovering this issue. I requested a couple of nitty changes, otherwise it looks great!
@kzlsakal Should be all tidied up now. Let me know if there's anything else that needs to be changed. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @jeffutter!
Hi there, this PR fixes an issue we were seeing when deployed in an application. I apologize for the lack of tests, but I'm not entirely sure why this error is happening or how to trigger it in tests. I wrote a few tests but they all pass regardless of the change.
Error
We're trying to support "Entity Queries" on an Interface, this is the "receiving end" of the
@interfaceObject
directive.Our schema looks roughly like this:
When writing unit tests setup like this in
absinthe_federation
it works fine. In our application either in tests or deployed I get the following error. I haven't been able to simplify it enough to figure out the difference between running in my application vs. inabsinthe_federation
unit tests.PR
Hopefully, this PR makes sense as-is and is useful. If someone can help me better understand how a middleware gets shimmed and why
absinthe_federation
has to call the (seemingly private)unshim
function. I'd be glad to contribute a more thorough solution with tests.