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
Describe the bug
After upgrading ts-node to 10.8.1 , there is an error reported by axios logger . The error is not seen while on earlier versions of ts-node.
Versions
TS-Node: 10.8.1
Axios Logger: 2.6.1
Error Message
Converting circular structure to JSON with ts-node upgrade
Error Stack
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'TLSSocket'
| property 'parser' -> object with constructor 'HTTPParser'
--- property 'socket' closes the circle
at JSON.stringify ()
at StringBuilder.makeData (/node_modules/axios-logger/src/common/string-builder.ts:67:9)
at responseLogger (/node_modules/axios-logger/src/logger/response.ts:20:10)
The text was updated successfully, but these errors were encountered:
nagarakesh4
changed the title
Converting circular structure to JSON with ts-node upgrade
Converting circular structure to JSON error with ts-node upgrade
Sep 8, 2022
@nagarakesh4 what is the version of ts-node you used previously? I have the same error with ts-node 10.4.0, in my case, specifically with responseType: 'stream'
Looks like the StringBuilder class does not differentiate between different payload types. Anything that is not a string it tries to jsonify. I worked around my specific case using this:
this.http.interceptors.request.use(AxiosLogger.requestLogger);
this.http.interceptors.response.use((res) => {
let data;
if (res.data instanceof IncomingMessage) {
data = res.data;
res.data = '<IncomingMessage>';
}
AxiosLogger.responseLogger(res);
if (data) {
res.data = data;
}
return res;
});
Describe the bug
After upgrading ts-node to 10.8.1 , there is an error reported by axios logger . The error is not seen while on earlier versions of ts-node.
Versions
TS-Node: 10.8.1
Axios Logger: 2.6.1
Error Message
Converting circular structure to JSON with ts-node upgrade
Error Stack
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'TLSSocket'
| property 'parser' -> object with constructor 'HTTPParser'
--- property 'socket' closes the circle
at JSON.stringify ()
at StringBuilder.makeData (/node_modules/axios-logger/src/common/string-builder.ts:67:9)
at responseLogger (/node_modules/axios-logger/src/logger/response.ts:20:10)
The text was updated successfully, but these errors were encountered: