TypeError: Cannot read properties of undefined (reading '0') using client.openSession();
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- next.js, node.js, sql, typescript
- 領域
- backend, build-system
調査の方向性
まず、next.config.js の webpack alias を使って app/api/databricks-test/route.ts の失敗を再現し、その後 examples/usage.js と比較します。@databricks/sql と node-int64/Int64.js を通る openSession の経路を追跡し、lz4 のワークアラウンドがもう TypeError を引き起こさないことを確認します。セッションが開き、サンプルクエリが結果を返し、すべての route-handler の分岐がレスポンスを返せば完了です。
索引モデルが issue の本文から書いたものです。
説明
Previously working code causing a TypeError: Cannot read properties of undefined (reading '0'). This code is from the following example: https://github.com/databricks/databricks-sql-nodejs/blob/HEAD/examples/usage.js
const { DBSQLClient } = require('@databricks/sql');
import { DBSQLLogger, LogLevel } from '@databricks/sql';
import { NextResponse } from "next/server";
export async function POST(){
const logger = new DBSQLLogger({ filepath: 'log.txt', level: LogLevel.debug });
const client = new DBSQLClient({ logger: logger });
console.log("CREATED CLIENT");
client
.connect({
host: process.env.DATABRICKS_SERVER_HOSTNAME,
path: process.env.DATABRICKS_HTTP_PATH,
token: process.env.DATABRICKS_TOKEN,
})
.then(async (client: { openSession: () => any; close: () => any; }) => {
const session = await client.openSession();
console.log("SESSION CREATED");
const queryOperation = await session.executeStatement('SELECT "Hello, World!"');
const result = await queryOperation.fetchAll();
await queryOperation.close();
console.table(result);
await session.close();
await client.close();
return NextResponse.json(result);
})
.catch((error: any) => {
console.log(error);
if (error instanceof Error) {
console.error("Error executing query: ", error);
return NextResponse.json(
{ error: "Failed to execute query: ", details: error.message },
{ status: 500 }
);
}
});
}
Console output:
{"level":"info","message":"Created DBSQLClient"}
CREATED CLIENT
TypeError: Cannot read properties of undefined (reading '0')
at isInsideNodeModules (node:internal/util:508:17)
at showFlaggedDeprecation (node:buffer:178:8)
at new Buffer (node:buffer:266:3)
at new module.exports (webpack-internal:///(rsc)/./node_modules/node-int64/Int64.js:65:34)
at DBSQLClient.eval (webpack-internal:///(rsc)/./node_modules/@databricks/sql/dist/DBSQLClient.js:197:111)
at Generator.next (<anonymous>)
at eval (webpack-internal:///(rsc)/./node_modules/@databricks/sql/dist/DBSQLClient.js:31:71)
at new Promise (<anonymous>)
at __awaiter (webpack-internal:///(rsc)/./node_modules/@databricks/sql/dist/DBSQLClient.js:27:12)
at DBSQLClient.openSession (webpack-internal:///(rsc)/./node_modules/@databricks/sql/dist/DBSQLClient.js:196:16)
at eval (webpack-internal:///(rsc)/./app/api/databricks-test/route.ts:25:38)
Error executing query: TypeError: Cannot read properties of undefined (reading '0')
at isInsideNodeModules (node:internal/util:508:17)
at showFlaggedDeprecation (node:buffer:178:8)
at new Buffer (node:buffer:266:3)
at new module.exports (webpack-internal:///(rsc)/./node_modules/node-int64/Int64.js:65:34)
at DBSQLClient.eval (webpack-internal:///(rsc)/./node_modules/@databricks/sql/dist/DBSQLClient.js:197:111)
at Generator.next (<anonymous>)
at eval (webpack-internal:///(rsc)/./node_modules/@databricks/sql/dist/DBSQLClient.js:31:71)
at new Promise (<anonymous>)
at __awaiter (webpack-internal:///(rsc)/./node_modules/@databricks/sql/dist/DBSQLClient.js:27:12)
at DBSQLClient.openSession (webpack-internal:///(rsc)/./node_modules/@databricks/sql/dist/DBSQLClient.js:196:16)
at eval (webpack-internal:///(rsc)/./app/api/databricks-test/route.ts:25:38)
⨯ Error: No response is returned from route handler '/home/slloyd/database_ai_assistant/app/api/databricks-test/route.ts'. Ensure you return a `Response` or a `NextResponse` in all branches of your handler.
at /home/slloyd/database_ai_assistant/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:53611
at async e_.execute (/home/slloyd/database_ai_assistant/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:44747)
at async e_.handle (/home/slloyd/database_ai_assistant/node_modules/next/dist/compiled/next-server/app-route.runtime.dev.js:6:54700)
at async doRender (/home/slloyd/database_ai_assistant/node_modules/next/dist/server/base-server.js:1377:42)
at async cacheEntry.responseCache.get.routeKind (/home/slloyd/database_ai_assistant/node_modules/next/dist/server/base-server.js:1599:28)
POST /api/databricks-test 500 in 133ms
The only change made was adding:
webpack: (config) => {
config.resolve.alias.lz4 = false;
return config;
},
to my next.config.js to prevent the following error:
Module not found: Can't resolve '../build/Release/xxhash'```
- 主要言語
- TypeScript
- スター
- 36
- フォーク
- 50
- 平均マージ
- 13時間 46分
- マージ済み PR(30日)
- 9
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
databricks/databricks-sql-nodejs のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
engineer-bot
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
databricks/databricks-sql-nodejs#274 · コメント 1 件 · リアクション 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
databricks/databricks-sql-nodejs の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
dennys-bd/agent-hive#184 ·
-
Add: hunch オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
AbdelStark/awesome-typesafe#104 ·
-
ai-observability bug team/ai-observability
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
vicharanashala/fln#563 ·
-
review: medium
難易度 1/5 1時間未満 初心者へのやさしさ 93/100
langgenius/dify#42764 · リアクション 1 件 ·