-
Notifications
You must be signed in to change notification settings - Fork 310
Open
Labels
Description
Screenshot
Client error thrown :
2025-03-26T09:56:04.848Z d664b5d1-55aa-4d0c-af6c-8689593ed960 INFO error thrown
2025-03-26T09:56:04.849Z d664b5d1-55aa-4d0c-af6c-8689593ed960 INFO _ClientError: GraphQL Error (Code: 400): {"response":{"status":400,"headers":{}},"request":{"query":"query {somequery}"}}
at runRequest2 (/var/task/handler.js:227231:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async GraphQLClient.request (/var/task/handler.js:227425:22)
at async GraphQLClient2.request (/var/task/handler.js:227647:20)
at async Object.fetchObjectIdsFromMaps (/var/task/handler.js:228261:22)
at async Object.getObjectId (/var/task/handler.js:228194:23)
at async _AttributeCriteriaConverter.initCriteriaValues (/var/task/handler.js:228915:38)
at async Object.buildAttributes (/var/task/handler.js:229287:5)
at async Object.execute (/var/task/handler.js:229265:33)
at async _Importer.execute (/var/task/handler.js:229753:26) {
response: {
status: 400,
headers: Headers {
date: 'Wed, 26 Mar 2025 09:56:04 GMT',
server: 'MaPS',
'x-xss-protection': '1; mode=block',
'strict-transport-security': 'max-age=31536000; includeSubDomains',
'content-security-policy': "default-src 'self' data: 'unsafe-hashes' 'unsafe-inline' 'unsafe-eval'; worker-src 'self' blob: 'unsafe-hashes' 'unsafe-inline' 'unsafe-eval'; frame-src 'self' youtube.com *.youtube.com *.youtube-nocookie.com data: 'unsafe-hashes' 'unsafe-inline' 'unsafe-eval'; img-src 'self' youtube.com *.youtube.com *.youtube-nocookie.com data: 'unsafe-hashes' 'unsafe-inline' 'unsafe-eval'; script-src-elem 'self' youtube.com *.youtube.com *.youtube-nocookie.com data: 'unsafe-hashes' 'unsafe-inline' 'unsafe-eval'; script-src-attr 'self' youtube.com *.youtube.com *.youtube-nocookie.com data: 'unsafe-hashes' 'unsafe-inline' 'unsafe-eval'; script-src 'self' youtube.com *.youtube.com *.youtube-nocookie.com data: 'unsafe-hashes' 'unsafe-inline' 'unsafe-eval'; style-src-elem 'self' data: 'unsafe-hashes' 'unsafe-inline' 'unsafe-eval'; style-src-attr 'self' data: 'unsafe-hashes' 'unsafe-inline' 'unsafe-eval'; style-src 'self' data: 'unsafe-hashes' 'unsafe-inline' 'unsafe-eval'; object-src 'none'",
'content-type': 'application/json',
expires: 'Thu, 19 Nov 1981 08:52:00 GMT',
'cache-control': 'no-store, no-cache, must-revalidate, no-cache, private',
pragma: 'no-cache',
'x-frame-options': 'sameorigin',
connection: 'close',
'transfer-encoding': 'chunked'
}
},
request: { query: 'query {somequery}', variables: undefined }
}
2025-03-26T09:56:04.850Z d664b5d1-55aa-4d0c-af6c-8689593ed960 INFO {
e: _ClientError: GraphQL Error (Code: 400): {"response":{"status":400,"headers":{}},"request":{"query":"query {somequery}"}}
at runRequest2 (/var/task/handler.js:227231:12)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async GraphQLClient.request (/var/task/handler.js:227425:22)
at async GraphQLClient2.request (/var/task/handler.js:227647:20)
at async Object.fetchObjectIdsFromMaps (/var/task/handler.js:228261:22)
at async Object.getObjectId (/var/task/handler.js:228194:23)
at async _AttributeCriteriaConverter.initCriteriaValues (/var/task/handler.js:228915:38)
at async Object.buildAttributes (/var/task/handler.js:229287:5)
at async Object.execute (/var/task/handler.js:229265:33)
at async _Importer.execute (/var/task/handler.js:229753:26) {
response: {
status: 400,
headers: Headers {...}
},
request: { query: 'query {somequery}', variables: undefined }
}
}
Description
graphql-request version 7.1.2
The GraphQl API I'm using returns explicit errors in the body, along with a 400 status code when the request is badly formed.
I need the body when such errors occur, so I tried using the errorPolicy: ignore
parameter in the Client, but the client still throws an error and I cannot see body being thrown.
Reproduction Steps/Repo Link
Install graphql-request version 7.1.2.
Setup a client with errorPolicy: ignore
.
Have an API return something in the body in case of a bad request.
Hit that API with a bad request.
See that the response body is never returned.
I may be doing something wrong but I don't know what it would be.
adamlindqvist and samausir