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

Compatibility issue with Graphql Code Generator Content-Length header not present. #2229

Closed
LiamKarlMitchell opened this issue Nov 11, 2022 · 1 comment
Labels
discussion Requires input from multiple people

Comments

@LiamKarlMitchell
Copy link

LiamKarlMitchell commented Nov 11, 2022

Describe the bug

Ran into a compatibility issue with Graphql Code Generator and Lighthouse.

When using Graphql Code Generator on Lighthouse, the library unidic (which got updated at some point) fails to load the introspection schema due to it not having a Content-Length header.

Related
dotansimha/graphql-code-generator#7934
nodejs/undici#1414

Expected behavior/Solution

Maybe lighthouse could return Content-Length for the introspection query?
Might be a way (user agent?) to tell if it is from Graphql Code Generator.

I had a work-around for this, but maybe it can be made more specific to just the introspection query now that I think about it further, but i'm not sure where abouts in Lighthouse code to put such a thing.

https://gist.github.com/LiamKarlMitchell/18f1e43ae6b772864d1b6a6ec1f71ba9

Steps to reproduce

  1. Have Lighthouse on Laravel running using sail docker container.
  2. Try to generate schema using code generator with it downloading the schema from the server directly.

Output/Logs

Logs are not relevant to lighthouse here, it is an issue with a dependency used in a third-party tool.
Lighthouse behaves perfectly fine in other tools and Graphql Playground for example.

Lighthouse Version

Observed on Lighthouse v5.61.0 but probably not caused by Lighthouse directly as it had worked perfectly fine before the undici dependency got updated in code generator.

@spawnia
Copy link
Collaborator

spawnia commented Nov 11, 2022

It looks like unidic is going to fix how they handle server responses, see nodejs/undici#1414.

Adding the Content-Length header seems like the responsibility of the Laravel framework, we are just using its facilities as plain as it can be to respond with JSON, see

return response($result);

Because of this, I think there is nothing for us to do here.

@spawnia spawnia added the discussion Requires input from multiple people label Nov 11, 2022
@spawnia spawnia closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Requires input from multiple people
Projects
None yet
Development

No branches or pull requests

2 participants