Rank 2: Process
I try to recive a large json response from eyternal graphQL, but I recive alwais the same issiue.
ERROR Error: Uncaught (in promise): SyntaxError: Unterminated string in JSON at position 999958SyntaxError: Unterminated string in JSON at position 999958 My code looks like that:
async graphQl(body) { const response = await fetch(url, { method: 'POST', headers: this.headers, body: JSON.stringify(body), }); if (response.ok) { return await response.json(); } else { throw new Error('GraphQL request failed: ' + response.status); } }and
try { const body = { query: req.payload, }; console.log("body", body) let responseQL = await graphQl(body) res.send(JSON.stringify(responseQL)); } catch (error) { res.json({ error: error }); }