我们正在对Cloud Firestore进行以下查询:
` var meeting = await db.collection("meetings").where(
"pin", "==", request.body.Digits).where(
"status", "==", "in-progress").get()`
这在我们的本地计算机上有效,但是当我们部署到EC2时失败。我们都在两者上都安装了Firestore客户端库,但是在部署时会对其进行Webpack。
此错误特别令人困惑,因为上面的代码段包装在try块中,但是在该行上抛出了以下错误而没有被捕获:
UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'node_modules/protobufjs/google/protobuf/api.proto'
at Object.openSync (fs.js:431:3)
at Object.readFileSync (fs.js:333:35)
at fetch (/home/node/server/app.compiled.js:350251:34)
at Root.load (/home/node/server/app.compiled.js:350285:13)
at Root.loadSync (/home/node/server/app.compiled.js:350326:17)
at Object.loadSync (/home/node/server/app.compiled.js:347406:17)
at Object../node_modules/@grpc/proto-loader/build/src/index.js (/home/node/server/app.compiled.js:65075:37)
at __webpack_require__ (/home/node/server/app.compiled.js:20:30)
at Object.<anonymous> (/home/node/server/app.compiled.js:222521:25)
at Object../node_modules/google-gax/build/src/grpc.js (/home/node/server/app.compiled.js:222775:30)
at __webpack_require__ (/home/node/server/app.compiled.js:20:30)
at Object../node_modules/google-gax/build/src/index.js (/home/node/server/app.compiled.js:222819:16)
at __webpack_require__ (/home/node/server/app.compiled.js:20:30)
at Object.<anonymous> (/home/node/server/app.compiled.js:44631:13)
at Object../node_modules/@google-cloud/firestore/build/src/v1/firestore_client.js (/home/node/server/app.compiled.js:45987:30)
at __webpack_require__ (/home/node/server/app.compiled.js:20:30)
(node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
我们已经尝试了几乎所有您能想到的事情,而没有实际更改查询-重新执行package.json和我们的构建脚本,但是无法弄清楚。有帮助吗?
答案 0 :(得分:0)
问题是Cloud Firestore的Node.js SDK使用gRPC进行通信,它基于本机代码构建,有几种解决方法,但是我建议将您的应用程序泊坞到{{3 }}
当尝试将sdk运行到AWS lambda时,此问题有点类似于this。
希望这会为您指明方向