【发布时间】:2021-12-02 20:01:46
【问题描述】:
我在 AWS Amplify 上使用 SSR 托管 Next.js Web 应用程序,直到有一天我收到错误 503。
在 AWS 控制台中挖掘时,我发现了处理应用程序 SSR 部分的 lambda 函数的 CloudWatch 日志。
2021-12-02T19:40:49.972Z 1bb29425-4acf-44aa-aabb-ba5afa558512 ERROR Invoke Error {
"errorType": "Error",
"errorMessage": "Cannot find module '@grpc/grpc-js/package.json'\nRequire stack:\n- /codebuild/output/src947501987/src/focalpick-client/node_modules/@firebase/firestore/dist/index.node.mjs",
"code": "MODULE_NOT_FOUND",
"requireStack": [
"/codebuild/output/src947501987/src/focalpick-client/node_modules/@firebase/firestore/dist/index.node.mjs"
],
"stack": [
"Error: Cannot find module '@grpc/grpc-js/package.json'",
"Require stack:",
"- /codebuild/output/src947501987/src/focalpick-client/node_modules/@firebase/firestore/dist/index.node.mjs",
" at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)",
" at Function.Module._load (internal/modules/cjs/loader.js:746:27)",
" at Module.require (internal/modules/cjs/loader.js:974:19)",
" at require (internal/modules/cjs/helpers.js:93:18)",
" at Object.578847 (/var/task/chunks/559.js:500372:34)",
" at __webpack_require__ (/var/task/webpack-runtime.js:25:43)",
" at Object.526541 (/var/task/chunks/962.js:2299:22)",
" at __webpack_require__ (/var/task/webpack-runtime.js:25:43)",
" at Module.778514 (/var/task/chunks/962.js:2021:20)",
" at __webpack_require__ (/var/task/webpack-runtime.js:25:43)"
]}
错误提示找不到模块@grpc/grpc-js。这似乎是 Firebase 在内部使用的一个包。我尝试在我的存储库中安装该软件包,重新部署了 Amplify 应用程序,但这无济于事。尝试部署一个干净的下一个应用程序虽然有效。
我阅读的所有问题都没有帮助我找到解决方案。
【问题讨论】:
-
您使用的是什么版本的 firebase SDK?这似乎是版本
9.5.0中引入的一个问题,请参阅github.com/firebase/firebase-js-sdk/issues/5752。我建议现在降级,直到发布修复程序。 -
@juliomalves 感谢您对问题的提示。我想这是版本 9.1.0 之后的 firebase 问题.. 但我不想降级回 v8.. 嗯
标签: amazon-web-services firebase aws-lambda next.js grpc