无法访问的路径意味着您正在尝试使用 Firebase 托管访问 Cloud Functions。当访问您的函数时出现问题时,就会出现该错误。只是为了给您一个想法,这里有一个具有类似错误的线程:
firebase SSR问题,弹出“应用程序请求访问您的谷歌帐户的权限”而不是网站 https://stackoverflow.com/questions/64486898/firebase-ssr-problem-app-requesting-permission-to-access-your-google-account
重要的提示:在讨论解决方案之前,您必须知道 Firebase Hosting 目前支持以下云功能美国中央1 https://firebase.google.com/docs/functions/locations#http_and_client-callable_functions。您不能将任何其他区域用于您的函数,例如 asia-east2。
接下来,您需要在托管部分设置重写规则,以服务于您在 Express 应用程序上配置的子路径:
firebase.json:
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [ {
"source": "/time",
"function": "app"
} ]
}
如果正确执行此操作,您应该能够通过以下路径访问您的函数:
https://<project-name>.web.app/time
请注意,Firebase Hosting 中的路径是/time, not /应用程序/时间.
参考:https://firebase.google.com/docs/hosting/functions#use_a_web_framework https://firebase.google.com/docs/hosting/functions#use_a_web_framework