question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

apollo-server-core 2.9.14 breaks APQ usage

See original GitHub issue

My GraphQL App server depends on apollo-server-express which I recently updated to 2.9.14 (which in turn resolves apollo-server-core 2.9.14). Upon updating to this version, my APQ queries started failing, with an internal error 500 as the response:

{
	"errors": [{
		"message": "[internal apollo-server error] addProtobufError called before startTiming!",
		"extensions": {
			"code": "INTERNAL_SERVER_ERROR",
			"exception": {
				"stacktrace": ["Error: 
[internal apollo-server error] addProtobufError called before startTiming!", "    
at internalError (/path-to-dir/node_modules/apollo-engine-reporting/dist/treeBuilder.js:6:12)", "    
at EngineReportingTreeBuilder.addProtobufError (/path-to-dir/node_modules/apollo-engine-reporting/dist/treeBuilder.js:72:19)", "    
at /path-to-dir/node_modules/apollo-engine-reporting/dist/treeBuilder.js:67:18", "    
at Array.forEach (<anonymous>)", "    
at EngineReportingTreeBuilder.didEncounterErrors (/path-to-dir/node_modules/apollo-engine-reporting/dist/treeBuilder.js:59:16)", "    
at EngineReportingExtension.didEncounterErrors (/path-to-dir/node_modules/apollo-engine-reporting/dist/extension.js:84:26)", "    
at /path-to-dir/node_modules/graphql-extensions/dist/index.js:29:27", "    
at Array.forEach (<anonymous>)", "    
at GraphQLExtensionStack.didEncounterErrors (/path-to-dir/node_modules/graphql-extensions/dist/index.js:27:25)", "    
at /path-to-dir/node_modules/apollo-server-core/dist/requestPipeline.js:268:32"
]
			}
		}
	}]
}

My expected response was:

{
	"errors": [{
		"message": "PersistedQueryNotFound",
		"extensions": {
			"code": "PERSISTED_QUERY_NOT_FOUND",
			"exception": {
				"stacktrace": [
"PersistedQueryNotFoundError: PersistedQueryNotFound", "    
at Object.<anonymous> (/path-to-dir/node_modules/apollo-server-core/dist/requestPipeline.js:75:52)", "    
at Generator.next (<anonymous>)", "    
at fulfilled (/path-to-dir/node_modules/apollo-server-core/dist/requestPipeline.js:5:58)", "    
at <anonymous>", "   
at process._tickCallback (internal/process/next_tick.js:189:7)"]
			}
		}
	}]
}

Upon further reading of code, I found this PR that changes the server-core and might be influencing the behavior: https://github.com/apollographql/apollo-server/commit/dcbbc34460e8de3a328acc0009d16839dfde849b

I am not sure if I am doing something wrong on the Apollo Client side, but

A prior release tag of app included 2.9.13 for both apollo-server-express and apollo-server-core works fine. My temp fix involved was to get that package-lock from that tag to ensure that it worked.

Note: Manually edited the error responses for easy reading and to redact private path structures

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:9
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
abernixcommented, Dec 27, 2019

This should be fixed by #3638, which I just released in v2.9.15.

2reactions
abbashassanalicommented, Mar 6, 2020

Hi. Seeing this error again in 2.11.0 It seems to throw even if engine is set to false.

errors": [ { "message": "[internal apollo-server error] addProtobufError called before startTiming!", "extensions": { "code": "INTERNAL_SERVER_ERROR", "exception": { "stacktrace": [ "Error: [internal apollo-server error] addProtobufError called before startTiming!", " at internalError (/var/task/node_modules/apollo-engine-reporting/dist/treeBuilder.js:8:12)", " at EngineReportingTreeBuilder.addProtobufError (/var/task/node_modules/apollo-engine-reporting/dist/treeBuilder.js:79:19)", " at /var/task/node_modules/apollo-engine-reporting/dist/treeBuilder.js:74:18", " at Array.forEach (<anonymous>)", " at EngineReportingTreeBuilder.didEncounterErrors (/var/task/node_modules/apollo-engine-reporting/dist/treeBuilder.js:61:16)", " at EngineReportingExtension.didEncounterErrors (/var/task/node_modules/apollo-engine-reporting/dist/extension.js:84:26)", " at /var/task/node_modules/graphql-extensions/dist/index.js:29:27", " at Array.forEach (<anonymous>)", " at GraphQLExtensionStack.didEncounterErrors (/var/task/node_modules/graphql-extensions/dist/index.js:27:25)", " at /var/task/node_modules/apollo-server-core/dist/requestPipeline.js:273:32", " at Generator.next (<anonymous>)", " at /var/task/node_modules/apollo-server-core/dist/requestPipeline.js:8:71", " at new Promise (<anonymous>)", " at __awaiter (/var/task/node_modules/apollo-server-core/dist/requestPipeline.js:4:12)", " at didEncounterErrors (/var/task/node_modules/apollo-server-core/dist/requestPipeline.js:271:20)", " at /var/task/node_modules/apollo-server-core/dist/requestPipeline.js:266:23" ] } } } ]

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling - Apollo GraphQL Docs
This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e., operationName ), or if the named operation...
Read more >
apollo-server-express v3.10.2 - npm.io
A full example of how to use apollo-server-express can be found in the docs. ... to break this compatibility at some point without...
Read more >
apollo-server-express - npm
Apollo Server is a community-maintained open-source GraphQL server that works with many Node.js HTTP server frameworks. Read the docs. Read the ...
Read more >
Capturing stack traces from GraphQLErrors in Apollo Server
Kibana version: 7.5.0 Elasticsearch version: 7.5.0 APM Server version: 7.5.0 ... const app = express(); /* ...a bunch of `app.use()` calls.
Read more >
apollo-server-core - NPM Package Overview - Socket.dev
This package implements the core logic of Apollo Server. It exports a base version of ApolloServer . Typically you do not use this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found