我创建了一个具有功能的简单动态Firebase托管,部署后一切正常,但在本地提供页面时一切正常。
这是firebase serve
i functions: Preparing to emulate functions.
i hosting: Serving hosting files from: public
✔ hosting: Local server: http://localhost:5004
✔ functions: serveLandingPage: http://localhost:5001/zonaskripsi18/us-central1/serveLandingPage
我们看到,控制台和firebase-debug.log
中都没有错误日志,但是当我打开http://localhost:5004
时,它显示了An internal error occurred while connecting to Cloud Function "serveLandingPage"
这是firebase.json
{
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint"
]
},
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "/**",
"function": "serveLandingPage"
}
]
}
}
答案 0 :(得分:0)
Firebase最近在其本地服务器上遇到了问题,只需部署它,然后运行它进行测试
答案 1 :(得分:0)
如果您的函数项目是Typescript,那么在为本地主机提供服务之前,您已经将Typescript编译为javascript文件。
cd functions
tsc