Repository navigation
"TypeError: Converting circular structure to JSON" when calling client.openSession() #85
Copy link
Copy link
Closed
Description
package version 1.0.0
nodejs 16.8
os linux
Hi folks, I'm having trouble opening a session.
I'm essentially using the example code in your readme:
let statement = `...`;
const client = new DBSQLClient();
client
.connect(connOptions)
.then(async (client) => {
const session = await client.openSession();
const queryOperation = await session.executeStatement(statement, { runAsync: true });
const result = await queryOperation.fetchAll();
await queryOperation.close();
console.table(result);
await session.close();
await client.close();
})
.catch((error) => {
console.log(error);
});The client is successfully created, but I get the following error:
{
"date": "Tue Nov 01 2022 11:28:52 GMT-0700 (Pacific Daylight Time)",
"error": {},
"exception": true,
"level": "error",
"message": "uncaughtException: Converting circular structure to JSON\n --> starting at object with constructor 'TLSSocket'\n | property 'parser' -> object with constructor 'HTTPParser'\n --- property 'socket' closes the circle\nTypeError: Converting circular structure to JSON\n --> starting at object with constructor 'TLSSocket'\n | property 'parser' -> object with constructor 'HTTPParser'\n --- property 'socket' closes the circle\n at JSON.stringify (<anonymous>)\n at exports.HttpConnection.<anonymous> (/***/node_modules/@databricks/sql/dist/DBSQLClient.js:92:69)\n at exports.HttpConnection.emit (node:events:394:28)\n at exports.HttpConnection.responseCallback (/***/node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js:173:12)\n at ClientRequest.connection.responseCallback (/***/node_modules/@databricks/sql/dist/connection/connections/HttpConnection.js:67:30)\n at Object.onceWrapper (node:events:514:26)\n at ClientRequest.emit (node:events:394:28)\n at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:621:27)\n at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)\n at TLSSocket.socketOnData (node:_http_client:487:22)",
"os": { "loadavg": [0.24, 0.32, 0.35], "uptime": 519547.65 },
"process": {
"argv": [
"/nix/store/p6h1iz5lcvfz1hg1z497ypa22rv52xxx-nodejs-16.8.0/bin/node",
"/***/dbHandlers/test2.js"
],
"cwd": "/***",
"execPath": "/nix/store/p6h1iz5lcvfz1hg1z497ypa22rv52xxx-nodejs-16.8.0/bin/node",
"gid": 100,
"memoryUsage": {
"arrayBuffers": 206093,
"external": 2085823,
"heapTotal": 17436672,
"heapUsed": 10880032,
"rss": 55578624
},
"pid": 355355,
"uid": 1000,
"version": "v16.8.0"
},
"stack": "TypeError: Converting circular structure to JSON\n --> starting at object with constructor 'TLSSocket'\n | property 'parser' -> object with constructor 'HTTPParser'\n --- property 'socket' closes the circle\n at JSON.stringify (<anonymous>)\n at exports.HttpConnection.<anonymous> (/***/node_modules/@databricks/sql/dist/DBSQLClient.js:92:69)\n at exports.HttpConnection.emit (node:events:394:28)\n at exports.HttpConnection.responseCallback (/***/node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js:173:12)\n at ClientRequest.connection.responseCallback (/***/node_modules/@databricks/sql/dist/connection/connections/HttpConnection.js:67:30)\n at Object.onceWrapper (node:events:514:26)\n at ClientRequest.emit (node:events:394:28)\n at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:621:27)\n at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)\n at TLSSocket.socketOnData (node:_http_client:487:22)",
"trace": [
{
"column": null,
"file": null,
"function": null,
"line": null,
"method": null,
"native": false
},
{
"column": null,
"file": null,
"function": "JSON.stringify",
"line": null,
"method": "stringify",
"native": false
},
{
"column": 69,
"file": "/***/node_modules/@databricks/sql/dist/DBSQLClient.js",
"function": null,
"line": 92,
"method": null,
"native": false
},
{
"column": 28,
"file": "node:events",
"function": "exports.HttpConnection.emit",
"line": 394,
"method": "emit",
"native": false
},
{
"column": 12,
"file": "/***/node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js",
"function": "exports.HttpConnection.responseCallback",
"line": 173,
"method": "responseCallback",
"native": false
},
{
"column": 30,
"file": "/***/node_modules/@databricks/sql/dist/connection/connections/HttpConnection.js",
"function": "ClientRequest.connection.responseCallback",
"line": 67,
"method": "responseCallback",
"native": false
},
{
"column": 26,
"file": "node:events",
"function": "Object.onceWrapper",
"line": 514,
"method": "onceWrapper",
"native": false
},
{
"column": 28,
"file": "node:events",
"function": "ClientRequest.emit",
"line": 394,
"method": "emit",
"native": false
},
{
"column": 27,
"file": "node:_http_client",
"function": "HTTPParser.parserOnIncomingClient [as onIncoming]",
"line": 621,
"method": "parserOnIncomingClient [as onIncoming]",
"native": false
},
{
"column": 17,
"file": "node:_http_common",
"function": "HTTPParser.parserOnHeadersComplete",
"line": 128,
"method": "parserOnHeadersComplete",
"native": false
},
{
"column": 22,
"file": "node:_http_client",
"function": "TLSSocket.socketOnData",
"line": 487,
"method": "socketOnData",
"native": false
}
]
}
I get this error whether the cluster is running or not.
I tried reverting back to 0.1.8-beta.2 but I get a different failure at the same step (it logs the whole request object and overflows my terminal, and terminates without throwing an error).
I've also tried various other node versions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
walkermalling commentedon Nov 1, 2022
It turns out this is what happens if the token value is incorrect.
kravets-levko commentedon Nov 1, 2022
kravets-levko commentedon Nov 4, 2022
Hi @walkermalling ! It turns out that you see an error that happened in logger while trying to log the original connection error. If possible, could you apply changes from #89 and share the actual error here? Thank you, and sorry for inconvenience
Sheing commentedon Dec 3, 2022
I am having the same exact issue as well.
{"date":"Sat Dec 03 2022 22:58:47 GMT+0000 (Coordinated Universal Time)","error":{},"exception":true,"level":"error","message":"uncaughtException: Converting circular structure to JSON\n --> starting at object with constructor 'TLSSocket'\n | property 'parser' -> object with constructor 'HTTPParser'\n --- property 'socket' closes the circle\nTypeError: Converting circular structure to JSON\n --> starting at object with constructor 'TLSSocket'\n | property 'parser' -> object with constructor 'HTTPParser'\n --- property 'socket' closes the circle\n at JSON.stringify (<anonymous>)\n at exports.HttpConnection.<anonymous> (/src/app/node_modules/@databricks/sql/dist/DBSQLClient.js:92:69)\n at exports.HttpConnection.emit (node:events:513:28)\n at exports.HttpConnection.emit (node:domain:489:12)\n at exports.HttpConnection.responseCallback (/src/app/node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js:173:12)\n at ClientRequest.connection.responseCallback (/src/app/node_modules/@databricks/sql/dist/connection/connections/HttpConnection.js:67:30)\n at Object.onceWrapper (node:events:628:26)\n at ClientRequest.emit (node:events:513:28)\n at ClientRequest.emit (node:domain:489:12)\n at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:693:27)","os":{"loadavg":[0.01,0.01,0],"uptime":8002.44},"process":{"argv":["/usr/local/bin/node","/src/app/dist/index"],"cwd":"/src/app","execPath":"/usr/local/bin/node","gid":0,"memoryUsage":{"arrayBuffers":18685018,"external":20692944,"heapTotal":65355776,"heapUsed":52376888,"rss":137351168},"pid":7,"uid":0,"version":"v16.18.0"},"stack":"TypeError: Converting circular structure to JSON\n --> starting at object with constructor 'TLSSocket'\n | property 'parser' -> object with constructor 'HTTPParser'\n --- property 'socket' closes the circle\n at JSON.stringify (<anonymous>)\n at exports.HttpConnection.<anonymous> (/src/app/node_modules/@databricks/sql/dist/DBSQLClient.js:92:69)\n at exports.HttpConnection.emit (node:events:513:28)\n at exports.HttpConnection.emit (node:domain:489:12)\n at exports.HttpConnection.responseCallback (/src/app/node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js:173:12)\n at ClientRequest.connection.responseCallback (/src/app/node_modules/@databricks/sql/dist/connection/connections/HttpConnection.js:67:30)\n at Object.onceWrapper (node:events:628:26)\n at ClientRequest.emit (node:events:513:28)\n at ClientRequest.emit (node:domain:489:12)\n at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:693:27)","trace":[{"column":null,"file":null,"function":null,"line":null,"method":null,"native":false},{"column":null,"file":null,"function":"JSON.stringify","line":null,"method":"stringify","native":false},{"column":69,"file":"/src/app/node_modules/@databricks/sql/dist/DBSQLClient.js","function":null,"line":92,"method":null,"native":false},{"column":28,"file":"node:events","function":"exports.HttpConnection.emit","line":513,"method":"emit","native":false},{"column":12,"file":"node:domain","function":"exports.HttpConnection.emit","line":489,"method":"emit","native":false},{"column":12,"file":"/src/app/node_modules/thrift/lib/nodejs/lib/thrift/http_connection.js","function":"exports.HttpConnection.responseCallback","line":173,"method":"responseCallback","native":false},{"column":30,"file":"/src/app/node_modules/@databricks/sql/dist/connection/connections/HttpConnection.js","function":"ClientRequest.connection.responseCallback","line":67,"method":"responseCallback","native":false},{"column":26,"file":"node:events","function":"Object.onceWrapper","line":628,"method":"onceWrapper","native":false},{"column":28,"file":"node:events","function":"ClientRequest.emit","line":513,"method":"emit","native":false},{"column":12,"file":"node:domain","function":"ClientRequest.emit","line":489,"method":"emit","native":false},{"column":27,"file":"node:_http_client","function":"HTTPParser.parserOnIncomingClient [as onIncoming]","line":693,"method":"parserOnIncomingClient [as onIncoming]","native":false}]}Is this fixed in newer version?
Sheing commentedon Dec 4, 2022
@kravets-levko I replaced with the logger fix, and now getting 2 new diff types of error:
and
fjakobs commentedon Dec 8, 2022
The fix in #89 works for me but how am I supposed to catch the error?
I came up with this monster and it seems to be the best I can do:
nisha-singh-tredence commentedon Dec 27, 2022
I have also getting same bugs, Please help me to resolve this issue
kravets-levko commentedon Jan 25, 2023
v1.1.0 with the fix was released. Please try it, and feel free to report if you still have any issues. Thank you for patience!