Skip to content

"An unexpected error occurred" in didEncounterError while executing a graphql query #377

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

Open
sailesh97 opened this issue Nov 29, 2024 · 1 comment

Comments

@sailesh97
Copy link

sailesh97 commented Nov 29, 2024

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

@sailesh97
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant