我有一个基于反应的快速现有项目,我成功地通过云功能将其移植到 Firebase 托管......至少在开发服务器上。它看起来像这样..这是使用命令在http://localhost:5000/上运行
firebase serve --only functions,hosting
Run Code Online (Sandbox Code Playgroud)
现在,当我部署它时,它看起来像
这不是静态网站。关注此处的 firebase 视频 https://www.youtube.com/watch?v=LOeioOKUKI8
所以我有快速服务器运行
app.use('/static',express.static('../public'));
Run Code Online (Sandbox Code Playgroud)
我必须这样做,因为否则,firebase 托管会将每个路径视为公共路径,并且它会弄乱来自公共文件夹的脚本以及反应应用程序中的反应路由器。
虽然这可以在 firebae 运行的本地服务器上运行,但它会在 prod 上抛出 404 错误。
Failed to load resource: the server responded with a status of 404 ()
Run Code Online (Sandbox Code Playgroud)
关键是我在本地计算机上完成了所有这些工作,但部署却无法满足要求。
部署并不顺利。
firebase deploy
Run Code Online (Sandbox Code Playgroud)
没用。
firebase --only hosting
Run Code Online (Sandbox Code Playgroud)
工作了。
firebase --only functions
Run Code Online (Sandbox Code Playgroud)
有一段时间没有工作。
它一直在扔
Error setting up the execution environment for your function. Please try again after a few minutes.
Run Code Online (Sandbox Code Playgroud)
几次才终于成功。我没有做任何改变来让它发挥作用。刚刚自己做的。
我有什么遗漏的吗?我对 firebase 托管非常陌生。
我已经在某处运行了一个生产站点,我希望将其移植到 firebase。但我不能随机出现“几分钟后重试的问题”。
但首先,为什么我的静态文件在开发环境中渲染时却没有在产品环境中渲染?
谢谢
firebase firebase-hosting google-cloud-functions firebase-cli
在本地成功配置firestore云功能。
能够使用以下命令在本地运行这些功能。
firebase var data = require('./data'); wChangedEvent(data.default);
... ... 打印 wChangedEvent 中的 console.log。所以这是正常工作的。
但我需要在 Visual Studio 代码中附加调试器。我尝试使用以下配置。
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 3535,
"protocol": "inspector"
},
Run Code Online (Sandbox Code Playgroud)
但它不起作用。
我正在尝试测试对我的网站的更改。但是当我进行更改并重新启动时,firebase serve --only hosting更改不会显示。
如果这很重要的话我正在使用Vuejs......
我正在尝试部署我的 firebase 函数,但所有函数都返回错误,我之前已经部署过,没有任何错误。自上次部署正确以来我没有安装任何新内容。每个函数都返回几乎相同的错误,唯一改变的是“errorId”
我尝试从 firebase-cli 注销并再次登录,我已从 npm 更新了 firebase-tools、firebase-admin、firebase-functions。我正在使用 firebase 部署 --only 功能进行部署
部署错误。构建失败:
{
"error": {
"canonicalCode": "INVALID_ARGUMENT",
"errorMessage": "`npm_install` had stderr output:\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/lodash-973f4ada/common/collection.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/node-29231f2f/inspector.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@types/node-f1c8db24/inspector.d.ts'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@firebase/auth-1b85ce5b/dist/auth.esm.js.map'\nnpm WARN tar ENOENT: no such file or directory, open '/workspace/node_modules/.staging/@firebase/webchannel-wrapper-e6854ec7/dist/index.js'\nnpm ERR! code E404\nnpm ERR! 404 Not …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 firebase 托管上部署我的项目。每当我使用firebase init它时,它都会在终端中显示错误,因为“firebaserc 已经有一个默认项目”,并且它会因该错误而退出
我再次尝试了 firebase 注销和 firebase 登录。并使用“firebase use”命令也更改了项目,但它仍在默认项目上执行 firebase init 操作
我想删除该默认项目
在使用本地 Firebase 函数模拟器作为我的后端设置我的项目,并从我的 Android 模拟器调用我的 Firebase onCall 函数后,我收到了这条非常无信息的错误消息PlatformException(functionsError, Cloud function failed with exception., {code: INTERNAL, details: null, message: INTERNAL})。完整的错误信息如下:
E/flutter (20862): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(functionsError, Cloud function failed with exception., {code: INTERNAL, details: null, message: INTERNAL})
E/flutter (21445): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter (21445): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:156:18)
E/flutter (21445): <asynchronous suspension>
E/flutter (21445): #2 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
E/flutter (21445): #3 MethodChannelCloudFunctions.callCloudFunction (package:cloud_functions_platform_interface/src/method_channel_cloud_functions.dart:43:15)
E/flutter (21445): #4 HttpsCallable.call (package:cloud_functions/src/https_callable.dart:33:12)
E/flutter (21445): #5 ApiService.loadUserLessonsByLessonIds (package:kim/services/api.dart:28:21)
E/flutter (21445): #6 MapScreen.build.<anonymous closure> (package:kim/screens/map.dart:170:34)
E/flutter (21445): …Run Code Online (Sandbox Code Playgroud) android firebase flutter google-cloud-functions firebase-cli
When I run firebase deploy I get this Node warning:
(node:14802) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
Run Code Online (Sandbox Code Playgroud)
I tried firebase deploy --only hosting and firebase deploy --only functions and got the same error message, so it's not my code.
I ran node --trace-warnings ... and got:
internal/modules/cjs/loader.js:1083
throw err;
^
Error: Cannot find module '/Users'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1080:15)
at Function.Module._load (internal/modules/cjs/loader.js:923:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Run Code Online (Sandbox Code Playgroud)
That …
每当我启动模拟器时,我都必须为实时数据库导入数据库,有时还需要手动为 firestore 制作顶级集合。
有没有办法设置模拟器,以便数据库已经准备好?
我不希望其中填充来自实际项目的所有数据,而是填充一些足以进行本地开发的虚拟数据。
再次强调,我并不是要求此设置来运行测试(如此处所述),而是用于日常开发。
firebase firebase-realtime-database google-cloud-functions google-cloud-firestore firebase-cli
尝试从根项目进行 firebase 部署时遇到以下消息
\n错误:...\\firestore.indexes.json 中的解析错误\n1:1 处出现意外标记“\xef\xbf\xbd”\n\xef\xbf\xbd\xef\xbf\xbd{
\n我有一个 flutter 应用程序,上面还有一个函数文件夹。下面是文件位置:
\n我在新建的电脑上运行 Windows 11(所以可能缺少某些东西?),其他开发人员在 mac 上运行,我已将函数文件夹的 3 个文件的 EOF 序列更改为 LF,我还运行了这两个函数文件夹内的命令
\nnpm install firebase-functions@latest firebase-admin@latest --save
npm install -g firebase-tools
npm 版本是 8.1.2
\n节点版本是v16.13.1 …
使用并运行以下命令安装的firebase-tools版本:10.0.1npm
命令:
firebase projects:create
? Please specify a unique project id (warning: cannot be modified afterward) [6-30 characters]:
tour-of-heroes
? What would you like to call your project? (defaults to your project ID) Tour of Heroes
Run Code Online (Sandbox Code Playgroud)
错误:
Error: Failed to create project because there is already a project with ID tour-of-heroes. Please try again with a unique project ID.
我尝试使用不同的项目 ID 和名称进行相同的操作,但得到相同的错误。
firebase-cli ×10
firebase ×9
flutter ×2
android ×1
angular ×1
deployment ×1
node.js ×1
npm ×1
vue.js ×1