You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running Apollo Server 4.10.1, I am running into an unhandled TypeError where extensions is undefined, so the error code cannot be retrieved from the object.
Here is the diff that solved my problem:
diff --git a/node_modules/@apollo/server/src/errorNormalize.ts b/node_modules/@apollo/server/src/errorNormalize.ts
index 55efdde..ecdb82d 100644
--- a/node_modules/@apollo/server/src/errorNormalize.ts+++ b/node_modules/@apollo/server/src/errorNormalize.ts@@ -60,11 +60,13 @@ export function normalizeAndFormatErrors(
const extensions: GraphQLErrorExtensions = {
...graphqlError.extensions,
- code:- graphqlError.extensions.code ??- ApolloServerErrorCode.INTERNAL_SERVER_ERROR,+ code: ApolloServerErrorCode.INTERNAL_SERVER_ERROR,
};
+ if (graphqlError && graphqlError.extensions && graphqlError.extensions.code) {+ extensions.code = graphqlError.extensions.code;+ }+
if (isPartialHTTPGraphQLHead(extensions.http)) {
mergeHTTPGraphQLHead(httpFromErrors, {
headers: new HeaderMap(),
The text was updated successfully, but these errors were encountered:
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.
When running Apollo Server 4.10.1, I am running into an unhandled TypeError where extensions is undefined, so the error code cannot be retrieved from the object.
Here is the diff that solved my problem:
The text was updated successfully, but these errors were encountered: