Skip to content

Commit 44277e4

Browse files
author
Sylvestre
authored
fix openSession unhandled error (#54)
1 parent 05c729d commit 44277e4

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

lib/databricks.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ export class DatabricksSingleton {
3131
* */
3232
export async function check(req, res, connection) {
3333
try {
34-
await connection.openSession();
34+
// If a session fails to open, currently the error is not propagating correctly.
35+
// see: https://github.com/databricks/databricks-sql-nodejs/issues/77
36+
await new Promise((resolve, reject) => {
37+
connection.on("error", reject).openSession().then(resolve);
38+
});
39+
3540
return {ok: true};
3641
} catch (e) {
3742
throw e;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"observable-database-proxy": "./bin/observable-database-proxy.js"
1919
},
2020
"dependencies": {
21-
"@databricks/sql": "^1.0.0",
21+
"@databricks/sql": "https://github.com/databricks/databricks-sql-nodejs#3df43263184aeaab1b473e65dfe08cb8fa9daaf4",
2222
"JSONStream": "^1.3.5",
2323
"ajv": "^8.11.0",
2424
"micro": "^9.3.4",

yarn.lock

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,10 +1119,9 @@
11191119
enabled "2.0.x"
11201120
kuler "^2.0.0"
11211121

1122-
"@databricks/sql@^1.0.0":
1122+
"@databricks/sql@https://github.com/databricks/databricks-sql-nodejs#3df43263184aeaab1b473e65dfe08cb8fa9daaf4":
11231123
version "1.0.0"
1124-
resolved "https://registry.yarnpkg.com/@databricks/sql/-/sql-1.0.0.tgz#aa12de5a364c1d15584de9807949e5ac957cef2d"
1125-
integrity sha512-73NVxH0tAVV/u2ns0T3tYpOvvAQ5kTFoQZATHpSlBBQRwTPKmzvHsq+jbpex/wqescoQ6TW9ZRf7W8sO4w2z4g==
1124+
resolved "https://github.com/databricks/databricks-sql-nodejs#3df43263184aeaab1b473e65dfe08cb8fa9daaf4"
11261125
dependencies:
11271126
commander "^9.3.0"
11281127
node-int64 "^0.4.0"

0 commit comments

Comments
 (0)