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
GraphQL throws TypeError: Cannot read property 'startToken' of undefined #271
Comments
@Multiply please provide how can I reproduce it. |
@obecny I'll see if I can make a tiny reproducible example for you. |
Here's a hack of a repro I threw together as I've bumped up against this issue as well. I'm not sure it's an issue with the instrumentation or how Apollo federation composing it's calls to graphql execute. Regardless, this seems to work for me: Set up a sample federation example:
Test via curl:
That should return:
To repro the error, prepend the following:
to the top of Then run server.js:
And hit the local service again via curl:
Which now returns:
The null is because the exception the original report cites is caught but not surfaced. This comes down to @apollo/gateway executeQueryPlan.executeQueryPlan function calling graphql.execute with an explict document structure that lacks the loc attribute (see In my casual testing, both solutions produced pretty similar output in Zipkin but nothing about my testing was particularly scientific. |
thx @gitelr will check it soon |
EDIT: No, ignoring spans without The same issue can be reproduced on my program. Only applications with both a build-in federation gateway and a I think the re-execute on gateway-js/src/executeQueryPlan.ts:81 may not need Here is a example from our application, and you can see this second execution happens after all real resolvers are called (in the first execution). |
I'm getting this error with api v 1.0.1 and graphql intrumentation 0.23.0 |
Any update on this issue? |
Possible solution: |
this should be fixed now -> #619 |
What version of OpenTelemetry are you using?
0.12.1-alpha.7
What version of Node are you using?
14.10.0
What did you do?
Followed the GraphQL example, and applied it to our project.
What did you expect to see?
I expected that my requests to our GraphQL server would work as before (and perhaps with slightly added delay due to tracing).
What did you see instead?
Additional context
We're using Apollo Server
We're also using federation
loc
can be undefined in the following bit of code:opentelemetry-js-contrib/plugins/node/opentelemetry-instrumentation-graphql/src/utils.ts
Line 226 in 4de41c8
I fixed it locally by adding the following code before checking for
startToken
:If it matters at least the first field type that fails, seems to be of type
Document
, when debugging further up the callstackThe text was updated successfully, but these errors were encountered: