AI Agent開発日記 2025/04/20この記事について 本記事は、Agent Builder を使用したデータストア参照型対話エージェントの作成に関する調査記録です。 やりたいこと Agent Builder を用いたデータス...
firebaseでの拡張機能を使ったelastic検索を試してみる。
やりたいこと
下記内容は完了して、次はデプロイをしたい。
Firebase Extensions のソースコードをGitHub などからローカルに持ってくる
extension.yamlやpackage.jsonなどを最新バージョンに更新
現状
デプロイする前にローカル環境で動作を確認しようと、Firebaseプロジェクトのtest_projectディレクトリ内で firebase emulators:startコマンドを実行したところElastic App Search クライアント (AppSearchClient) を初期化しようとしている箇所 (functions/lib/utils.js) でTypeError: AppSearchClient is not a constructorというエラーが発生、 Functions を正常にロードできていない事が原因
問題の解決策を調査中。
ERROR内容
$ firebase emulators:start
i emulators: Starting emulators: auth, functions, firestore, extensions
⬢ extensions: Unable to look up project number for [your-project-id].
If this is a real project, ensure that you are logged in and have access to it.
If this is a fake project, please use a project ID starting with 'demo-' to skip production calls.
Continuing with a fake project number - secrets and other features that require production access may behave unexpectedly.
⚠ emulators: It seems that you are running multiple instances of the emulator suite for project [your-project-id]. This may result in unexpected behavior.
⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: apphosting, database, hosting, pubsub, storage, dataconnect
⚠ functions: Application Default Credentials detected. Non-emulated services will access production using these credentials. Be careful!
⚠ functions: Unable to fetch project Admin SDK configuration, Admin SDK behavior in Cloud Functions emulator may be incorrect.
i firestore: Firestore Emulator logging to firestore-debug.log
✔ firestore: Firestore Emulator UI websocket is running on 9151.
i functions: Watching "firebase-elastic2/app-search-firestore-extension/functions" for Cloud Functions...
⚠ functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.
⚠ functions: Please note that there will be breaking changes when you upgrade.
✔ functions: Using node@20 from host.
i functions: You are using a version of firebase-functions SDK (4.9.0) that does not have support for the newest Firebase Extensions features. Please update firebase-functions SDK to >=5.1.0 to use them correctly
Serving at port 8941
TypeError: AppSearchClient is not a constructor
at getNewAppSearchClient (firebase-elastic2/app-search-firestore-extension/functions/lib/utils.js:43:12)
at Object.<anonymous> (firebase-elastic2/app-search-firestore-extension/functions/lib/shipToElastic.js:115:59)
at Module._compile (node:internal/modules/cjs/loader:1529:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
at Module.load (node:internal/modules/cjs/loader:1275:32)
at Module._load (node:internal/modules/cjs/loader:1096:12)
at Module.require (node:internal/modules/cjs/loader:1298:19)
at require (node:internal/modules/helpers:182:18)
at Object.<anonymous> (firebase-elastic2/app-search-firestore-extension/functions/lib/index.js:4:23)
at Module._compile (node:internal/modules/cjs/loader:1529:14)
⬢ functions: Failed to load function definition from source: FirebaseError: Functions codebase could not be analyzed successfully. It may have a syntax or runtime error
┌─────────────────────────────────────────────────────────────┐
│ ✔ All emulators ready! It is now safe to connect your app. │
│ i View Emulator UI at http://127.0.0.1:4000/ │
└─────────────────────────────────────────────────────────────┘
┌────────────────┬────────────────┬──────────────────────────────────┐
│ Emulator │ Host:Port │ View in Emulator UI │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Authentication │ 127.0.0.1:9099 │ http://127.0.0.1:4000/auth │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Functions │ 127.0.0.1:5001 │ http://127.0.0.1:4000/functions │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Firestore │ 127.0.0.1:8082 │ http://127.0.0.1:4000/firestore │
├────────────────┼────────────────┼──────────────────────────────────┤
│ Extensions │ 127.0.0.1:5001 │ http://127.0.0.1:4000/extensions │
└────────────────┴────────────────┴──────────────────────────────────┘
Emulator Hub host: 127.0.0.1 port: 4400
Other reserved ports: 4500, 9151
┌─────────────────────────┬───────────────┬─────────────────────┐
│ Extension Instance Name │ Extension Ref │ View in Emulator UI │
└─────────────────────────┴───────────────┴─────────────────────┘
Issues? Report them at https://github.com/firebase/firebase-tools/issues and attach the *-debug.log files.