- 
                Notifications
    
You must be signed in to change notification settings  - Fork 23
 
Description
While migrating from apollo-server v3 to v4 getting error while executing few graphql queries, whereas it's working fine for other graphql queries
SOME_GRAPHQL_QUERY TypeError: The "list" argument must be an instance of SharedArrayBuffer, ArrayBuffer or ArrayBufferView.
    at TextDecoder.decode (node:internal/encoding:443:16)
    at Qe.someApplicationFunction1 (path/build/server.js:1:130571)
    at Qe.didEncounterError (path/build/server.js:1:133550)
    at path/node_modules/@apollo/datasource-rest/dist/RESTDataSource.js:236:26
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Qe.fetch (path/node_modules/@apollo/datasource-rest/dist/RESTDataSource.js:269:21)
    at async Qe.post (path/node_modules/@apollo/datasource-rest/dist/RESTDataSource.js:127:17)
    at async Qe.t.timeout (path/build/server.js:1:135424) {
  code: 'ERR_INVALID_ARG_TYPE'
}
The error.extensions.response.body received in didEncounterError is:
{
  message: 'An unexpected error occurred',
  request_id: '59ba9f0ad155044a5f9d983891ab9559'
}
Upon analysing the issue from the error callstack, found that the error is originating from const parsedBody = await this.parseBody(response);  inside performRequest method.
Inside parsedBody, these are values found in response:
contentType: application/json; charset=utf-8
contentLength: 97
response.status: 500
As the graphql server working fine for other queries, I suspect there might be some issue in the schema of few queries for which it fails with the above error message. So I tried running the query by passing just one String type input but it still failed with same error.
Any assistance on this would be highly appreciated
Versions used:
node: v20.17.0
graphql: ^16.9.0
@apollo/datasource-rest: ^6.3.0
@apollo/server: ^4.11.2
graphql-tag: ^2.12.6