简体   繁体   English

无法在 firebase 上部署功能

[英]Could not deploy functions on firebase

After running the command line firebase deploy --only functions , I have these errors:运行命令行firebase deploy --only functions ,出现以下错误:

在此处输入图片说明

Below you may find also the logs in the firebase:您还可以在下面找到 firebase 中的日志: 在此处输入图片说明

I tried multiple times to run the command for deploy and the logs show different messages, these the last ones:我多次尝试运行部署命令,日志显示不同的消息,这些是最后一条:

11:13:12.563 PM
api
Error: function terminated. Recommended action: inspect logs for termination reason. Function cannot be initialized.
 
11:13:12.615 PM
api
{"@type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":3,"message":"Function failed on loading user code. Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs"},"authenticationInfo":{"principalEmail":"taobardhi@gmail.com"},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.UpdateFunction","resourceName":"projects/clone-react-dfee2/locations/us-central1/functions/api"}

Your error might be probably caused by a syntax code error or any other code problem.您的错误可能是由语法代码错误或任何其他代码问题引起的。

As the error message recommends you will find further information about the error by examining the corresponding entry log in the Cloud Console:正如错误消息所建议的,您可以通过检查 Cloud Console 中的相应条目日志来找到有关错误的更多信息:

https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs

Another option would be to run your functions locally before deploying them to check if they work as expected.另一种选择是在部署函数之前在本地运行它们以检查它们是否按预期工作。

I was facing similar error "code": 3 on firebase console while deploying a cloud function.在部署云功能时,我在 firebase 控制台上遇到了类似的错误"code": 3

For me, adding module dependencies in package.json file with correct version numbers and running npm install (with 0 vulnerability ) worked.对我来说,使用正确的版本号在package.json文件中添加模块依赖项并运行npm install (有0 vulnerability )是有效的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM