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

generated models across loaded packages causes error merging type systems #1762

Closed
StevenACoffman opened this issue Jan 13, 2022 · 4 comments · Fixed by #1763
Closed

generated models across loaded packages causes error merging type systems #1762

StevenACoffman opened this issue Jan 13, 2022 · 4 comments · Fixed by #1763
Labels
help wanted Extra attention is needed

Comments

@StevenACoffman
Copy link
Collaborator

What happened?

If models are generated in a package that has already been loaded, and
that package refers to another package that has already been loaded, we
can find ourselves in a position where it appears that a GQL union is
not satisfied.

#1020 introduces the
code that fails in this scenario. This was supposed to be addressed in #1491 by @wendorf
but per @ipfans #1491 (comment) it appears to still be occurring.

This repository currently reproduces the issue reliably:
https://github.com/ipfans/gqlgen-error

and is currently getting this error:

merging type systems failed: unable to bind to interface: xxx/src/business/entity.A does not satisfy the interface gitlab.com/hookactions/gqlgen-relay/relay.Node
@ipfans
Copy link
Contributor

ipfans commented Jan 14, 2022

I am trying to debug this bug, then I found cfg.ReloadAllPackages() is never called before error. After add this, I think everything works now. I will submit a PR soon.

StevenACoffman added a commit that referenced this issue Jan 14, 2022
* Fix #1762: Reload packages before merging type systems

* run gofmt on file

Signed-off-by: Steve Coffman <steve@khanacademy.org>

Co-authored-by: Steve Coffman <steve@khanacademy.org>
@frederikhors
Copy link
Collaborator

Should we release a patch version with all these news?

@StevenACoffman
Copy link
Collaborator Author

@frederikhors I released v0.15.0 right after this merged as this was the final bug fix I was waiting for to land. We're using this same version in production at scale at Khan, and I feel like it's been very solid.

@frederikhors
Copy link
Collaborator

frederikhors commented Jan 15, 2022

Yeah it is solid. gqlgen is amazing. Really makes me thankful for life.

Can we open the discussions tab, @StevenACoffman, please, so we can be able to move there issues that are simple questions? (already requested in #1722)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants