Firebase功能部署需要GCP中的键盘输入 [英] Firebase Functions deploy requires keyboard input in GCP
问题描述
最近,当尝试部署Firebase功能时,出现以下错误:
Recently, when trying to deploy my Firebase Functions i get the following error:
...
functions[verify(us-central1)]: Deployment error.
Build failed: Build error details not available. Please check the logs at
...
GCP日志:
labels.build_step | resource.type | 严重程度 | textPayload |
---|---|---|---|
主要 | 构建 | INFO | 错误:获取存储源错误:通用::未知:重试预算用尽(3次尝试):获取gcs源:从gcs中解包源:源获取容器退出,状态为非零:1 |
主要 | 构建 | INFO | 错误 |
gsutil:STDOUT | 构建 | INFO | 存档:/tmp/source-archive.zip |
gsutil:STDERR | 构建 | INFO | (EOF或读取错误,被视为"[N] one" ...) |
gsutil:STDERR | 构建 | INFO | 替换/workspace/.runtimeconfig.json?[y] es,[n] o,[A] ll,[N] one,[r] ename:NULL |
gsutil:STDERR | 构建 | INFO | 操作已完成1个对象/89.4 KiB. |
gsutil:STDERR | 构建 | INFO | /[0个文件] [0.0 B/89.4 KiB]/[1个文件] [89.4 KiB/89.4 KiB] |
gsutil:STDERR | 构建 | INFO | 复制gs://gcf-sources-972818261280-us-central1/verify-d55557e5-9fcf-4a3d-b144-17690c85f5a1/version-182/function-source.zip#1611906282665422 ... |
主要 | 构建 | INFO | 获取存储对象:gs://gcf-sources-972818261280-us-central1/verify-d55557e5-9fcf-4a3d-b144-17690c85f5a1/version-182/function-source.zip#1611906282665422 |
gsutil:STDERR | 构建 | INFO | (EOF或读取错误,被视为"[N] one" ...) |
gsutil:STDERR | 构建 | INFO | 替换/workspace/.runtimeconfig.json?[y] es,[n] o,[A] ll,[N] one,[r] ename:NULL |
gsutil:STDOUT | 构建 | INFO | 存档:/tmp/source-archive.zip |
gsutil:STDERR | 构建 | INFO | 操作已完成1个对象/89.4 KiB. |
gsutil:STDERR | 构建 | INFO | /[0个文件] [0.0 B/89.4 KiB]/[1个文件] [89.4 KiB/89.4 KiB] |
gsutil:STDERR | 构建 | INFO | 复制gs://gcf-sources-972818261280-us-central1/verify-d55557e5-9fcf-4a3d-b144-17690c85f5a1/version-182/function-source.zip#1611906282665422 ... |
主要 | 构建 | INFO | 获取存储对象:gs://gcf-sources-972818261280-us-central1/verify-d55557e5-9fcf-4a3d-b144-17690c85f5a1/version-182/function-source.zip#1611906282665422 |
gsutil:STDERR | 构建 | INFO | 错误的CRC 4992186c(应该为00000000) |
gsutil:STDOUT | 构建 | INFO | 膨胀:/workspace/tslint.json |
gsutil:STDOUT | 构建 | INFO | 膨胀:/workspace/tsconfig.json |
gsutil:STDOUT | 构建 | INFO | 膨胀:/workspace/src/index.ts |
gsutil:STDOUT | 构建 | INFO | 膨胀:/workspace/src/booking.mjml |
gsutil:STDOUT | 构建 | INFO | 充气:/workspace/src/booking.html |
gsutil:STDOUT | 构建 | INFO | 膨胀:/workspace/package.json |
gsutil:STDOUT | 构建 | INFO | 膨胀:/workspace/package-lock.json |
gsutil:STDOUT | 构建 | INFO | 膨胀:/workspace/lib/index.js.map |
gsutil:STDOUT | 构建 | INFO | 膨胀:/workspace/lib/index.js |
gsutil:STDOUT | 构建 | INFO | 膨胀:/workspace/.runtimeconfig.json膨胀:/workspace/.gitignore |
gsutil:STDOUT | 构建 | INFO | 存档:/tmp/source-archive.zip |
gsutil:STDERR | 构建 | INFO | 操作已完成1个对象/89.4 KiB. |
gsutil:STDERR | 构建 | INFO | /[0个文件] [0.0 B/89.4 KiB]/[1个文件] [89.4 KiB/89.4 KiB] |
gsutil:STDERR | 构建 | INFO | 复制gs://gcf-sources-972818261280-us-central1/verify-d55557e5-9fcf-4a3d-b144-17690c85f5a1/version-182/function-source.zip#1611906282665422 ... |
主要 | 构建 | INFO | 获取存储对象:gs://gcf-sources-972818261280-us-central1/verify-d55557e5-9fcf-4a3d-b144-17690c85f5a1/version-182/function-source.zip#1611906282665422 |
主要 | 构建 | INFO | FETCHSOURCE |
主要 | 构建 | INFO | 开始构建"f8f97fdd-29ff-4964-a080-26ba4bdd5705" |
显然,我需要按一个键来替换/workspace/.runtimeconfig.json,这显然是我做不到的.还有一个CRC不匹配.
Apparently it requires me to to press a key to replace /workspace/.runtimeconfig.json, which i obviously can't do. There is also a CRC mismatch.
我已通过云功能"选项卡删除了这些功能,并重新安装了所有节点模块,但错误仍然存在.
I've deleted the functions via the Cloud Functions tab and reinstalled all my node modules, but the error persists.
推荐答案
< TL/DR>从节点15降级到节点14或节点12可以解决此问题.
<TL/DR> Downgrading from Node 15 to Node 14 or Node 12 solves the problem.
我的环境:
我正在运行带有M1 ARM芯片的MacBook Air.我不知道它是否相关,但可能与此相关.
I'm running a MacBook Air with the M1 ARM chip. I don't know if it is related or not but it might be.
已知可以使用的版本组合:
当前正在使用firebase-tools 9.2.2运行v14.15.4 x64.这种组合似乎毫无毛病.
Currently running v14.15.4 x64 with firebase-tools 9.2.2. That combination seems to work without a glitch.
在此之前,我已经尝试使用firebase-tools 9.2.2尝试v12.20.1 x64,并且效果很好.
Before settling on that I've tried v12.20.1 x64 with firebase-tools 9.2.2 and that worked as well.
我尝试过并失败的版本组合:
我尝试使用firebase工具9.2.2、9.2.1、9.2.0、9.1.2和8.20.0尝试使用arm64和x64节点v15.6.0,但均未成功.
I've tried node v15.6.0, both arm64 and x64, with firebase-tools 9.2.2, 9.2.1, 9.2.0, 9.1.2 and 8.20.0 without success.
还尝试了使用firebase-tools 9.2.2的v15.7.0 arm64节点,但未成功.
Also tried node v15.7.0 arm64 with firebase-tools 9.2.2 without success.
在M1 Mac上获取它们:
如果像我一样,您正在使用M1 Mac,您可能已经知道v14无法在M1中进行编译.对于非v15.5或更高版本,您需要使用x64版本.
If you, like me, are using an M1 Mac, you might already know v14 won't compile in the M1. You'll need to use x64 versions for anything that is not v15.5 or above.
关于x64版本的许多指南以及官方的NodeJS 下载都可以正常运行在rosetta 2上(不要尝试ARM的,这仅适用于Linux,不适用于您的Mac).
There are many guides and also the official NodeJS download for the x64 versions that will run just fine on rosetta 2 (do not try the ARM ones, those are for Linux only at this point and won't work on your Mac).
如果您正在使用 nvm 来管理您的版本,并且希望同时拥有x64和arm64版本安装,这是我的方法:
If you are using nvm to manage your versions and want to have both x64 and arm64 versions installed, this is how I did it:
使x64和arm64版本一起使用:
nvm install
将添加一个节点版本.如果您对计算机没有任何特殊要求,那么 nvm install 15
应该适合您.M1尚无预编译的二进制文件,因此请等待几分钟(超过10分钟).
nvm install
will add a node version. If you did nothing special to your machine then nvm install 15
should work for you. There are no pre-compiled binaries for the M1 just yet, so be prepared to wait some minutes(more than 10).
要获得Node 14的设置,只需打开一个新的终端窗口,然后键入 arch -x86_64 zsh
,这将在x64模式下启动一个新的zsh进程.在同一终端上,键入 nvm install 14
.那应该比v15快得多,并且取决于您的互联网速度,只需几秒钟即可返回.你们都准备好了.关闭此终端标签并忘记它曾经存在.
To get Node 14 setup just open a new terminal window and type in arch -x86_64 zsh
, that will start a new zsh process in x64 mode. On that same terminal type nvm install 14
. That should be much faster than v15 and, depending on your internet speed, return in just a few seconds. You are all set. close this terminal tab and forget it ever existed.
现在运行 nvm use 15
将设置节点运行v15 arm64版本,运行 nvm use 14
将运行v14 x64版本.
Now running nvm use 15
will set node to run the v15 arm64 version and running nvm use 14
will run the v14 x64 version.
要检查节点版本,可以运行 node --version
,要检查体系结构,可以运行 node -p"process.arch"
To check your node version you can run node --version
and to check the architecture you can run node -p "process.arch"
这篇关于Firebase功能部署需要GCP中的键盘输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!