Я создал простой динамический хостинг 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"
}
]
}
}
Это скриншот:
![enter image description here](https://i.stack.imgur.com/vIsRl.png)