You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since version 1.8.4 error messages in the log appear whenever a service response is not a JSON document or the JSON is longer then 1,000 characters.
ERROR SyntaxError: Unterminated string in JSON at position 1003 at JSON.parse (<anonymous>) at Fi (file:///usr/src/app/node_modules/.pnpm/@portkey-ai+gateway@1.9.3/node_modules/@portkey-ai/gateway/build/start-server.js:2:260672) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
The change does not take into account that a response is not always json. And if it is json but longer than 1,000 characters, it truncates the json and tries to parse it.
@narengogi It would be greatly appreciated if you could remove the check. This also becomes messy when using guardrails, as the response is usually more than 1,000 characters in length then.
What Happened?
Since version 1.8.4 error messages in the log appear whenever a service response is not a JSON document or the JSON is longer then 1,000 characters.
ERROR SyntaxError: Unterminated string in JSON at position 1003 at JSON.parse (<anonymous>) at Fi (file:///usr/src/app/node_modules/.pnpm/@portkey-ai+gateway@1.9.3/node_modules/@portkey-ai/gateway/build/start-server.js:2:260672) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
What Should Have Happened?
No error messages.
Relevant Code Snippet
The commit introducing the error: cf25af7
The change does not take into account that a response is not always json. And if it is json but longer than 1,000 characters, it truncates the json and tries to parse it.
src/middlewares/log/index.ts:
JSON.parse(responseString.substring(0, maxLength) + '...')
Your Twitter/LinkedIn
No response
The text was updated successfully, but these errors were encountered: