首页 > 解决方案 > firebase 函数组部署错误(未定义)

问题描述

我正在尝试部署 firebase 函数 index.js 文件。如果我尝试部署单个功能,例如(firebase deploy --only functions:phaseStart),它运行良好。但是,如果我部署整个函数文件夹,例如(firebase deploy --only 函数),就会出现错误。我昨天刚刚部署了这个功能,但这些都没有发生。index.js 文件有问题吗?还是我部署了这么多功能?

错误代码如下。

+  functions: Finished running predeploy script.
i  functions: ensuring necessary APIs are enabled...
+  functions: all necessary APIs are enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (46.47 KB) for uploading
+  functions: functions folder uploaded successfully
i  functions: updating Node.js 8 function roomRemoved(asia-northeast1)...
i  functions: updating Node.js 8 function gameStart(asia-northeast1)...
i  functions: updating Node.js 8 function phaseStart(asia-northeast1)...
i  functions: updating Node.js 8 function nightAction(asia-northeast1)...
i  functions: updating Node.js 8 function vote(asia-northeast1)...
i  functions: updating Node.js 8 function userCreated(asia-northeast1)...
i  functions: updating Node.js 8 function userDeleted(asia-northeast1)...
!  functions[userDeleted(asia-northeast1)]: Deployment error.
undefined
!  functions[phaseStart(asia-northeast1)]: Deployment error.
undefined
!  functions[vote(asia-northeast1)]: Deployment error.
undefined
!  functions[gameStart(asia-northeast1)]: Deployment error.
undefined
!  functions[roomRemoved(asia-northeast1)]: Deployment error.
undefined
!  functions[nightAction(asia-northeast1)]: Deployment error.
undefined
+  functions[userCreated(asia-northeast1)]: Successful update operation.


Functions deploy had errors with the following functions:
        gameStart
        nightAction
        phaseStart
        roomRemoved
        userDeleted
        vote


To try redeploying those functions, run:
    firebase deploy --only functions:gameStart,functions:nightAction,functions:phaseStart,functions:roomRemoved,functions:userDeleted,functions:vote


To continue deploying other features (such as database), run:
    firebase deploy --except functions

Error: Functions did not deploy properly.

我还在firebase控制台上找到了审计日志。

{"@type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":13,"message":"INTERNAL"},"authenticationInfo":{"principalEmail":"blabla"},"requestMetadata":{"requestAttributes":{},"destinationAttributes":{}},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.UpdateFunction","resourceName":"projects/blabla/locations/asia-northeast1/functions/gameStart"}

这是我的职能之一。

exports.userDeleted = functions
  .region('asia-northeast1')
  .auth.user().onDelete(async user => {
    return db.collection('uid_list').doc(user.uid).delete().catch(e => {
      console.error(e.code)
      console.log(e.message)
    })
  })

标签: firebasegoogle-cloud-firestoregoogle-cloud-functions

解决方案


推荐阅读