-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
The blockFieldSuggestion plugin's didEncounterErrors handler calls error.message.replace() without checking if error.message is defined, causing a TypeError when Apollo Server encounters a GraphQL error with an undefined message.
Stack trace:
TypeError: Cannot read properties of undefined (reading 'replace')
at Object.didEncounterErrors (node_modules/@escape.tech/graphql-armor/dist/graphql-armor.cjs.dev.js:63:43)
at node_modules/@apollo/server/src/requestPipeline.ts:757:31
at Array.map (<anonymous>)
at didEncounterErrors (node_modules/@apollo/server/src/requestPipeline.ts:756:24)
at processGraphQLRequest (node_modules/@apollo/server/src/requestPipeline.ts:505:15)
Affected code:
In packages/plugins/block-field-suggestions/src/index.ts, the formatter does:
error.message.replace(/Did you mean ".+"\?/g, mask).trim();
There is no guard against error.message being undefined or null.
Environment:
- @escape.tech/graphql-armor: 3.2.0
- @apollo/server: 5.x
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels