简体   繁体   English

错误:发生意外错误。 Firebase功能

[英]Error: An unexpected error has occurred. Firebase Functions

I have updated firebase-functions to version 1.0.2, firebase-tools to 3.18.4, firebase-admin to 5.12.0 我已经将firebase-functions更新为1.0.2版,将firebase-tools更新为3.18.4,将firebase-admin更新为5.12.0

I am uploading a function that generate thumbnails taken from https://github.com/firebase/functions-samples/tree/master/quickstarts/thumbnails 我正在上传一个函数,该函数生成从https://github.com/firebase/functions-samples/tree/master/quickstarts/thumbnails提取的缩略图

[debug] [2018-04-26T09:00:12.812Z] <<< HTTP RESPONSE 400

[debug] [2018-04-26T09:00:12.812Z] <<< HTTP RESPONSE BODY <?xml version='1.0' encoding='UTF-8'?><Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message></Error>

[debug] [2018-04-26T09:00:12.813Z] TypeError: Cannot create property 'error' on string '<?xml version='1.0' encoding='UTF-8'?><Error><Code>InvalidArgument</Code><Message>Invalid argument.</Message></Error>'
at module.exports (C:\Users\NASA\AppData\Roaming\npm\node_modules\firebase-tools\lib\responseToError.js:11:16)
at Request._callback

(C:\Users\NASA\AppData\Roaming\npm\node_modules\firebase-tools\lib\api.js:47:25)
at Request.self.callback

(C:\Users\NASA\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\request.js:186:22)
at Request.emit (events.js:180:13)
at Request.emit (domain.js:421:20)
at Request.<anonymous> 

(C:\Users\NASA\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\request.js:1163:10)
at Request.emit (events.js:180:13)
at Request.emit (domain.js:421:20)
at IncomingMessage.<anonymous> 

(C:\Users\NASA\AppData\Roaming\npm\node_modules\firebase-tools\node_modules\request\request.js:1085:12)
at Object.onceWrapper (events.js:272:13)


[error] Error: An unexpected error has occurred.

You said that: 你之前这么说:

  1. You have updated firebase-functions to version 1.0.2 您已将Firebase功能更新至1.0.2版
  2. The code is cloned from the Cloud Function sample without any change 该代码是从Cloud Function示例中克隆的,没有任何更改

So most probably your problem comes form the fact that Cloud Functions V1.0.0 and above have changed, see the doc https://firebase.google.com/docs/functions/beta-v1-diff#storage 因此,很可能您的问题来自Cloud Functions V1.0.0及更高版本已更改的事实,请参阅文档https://firebase.google.com/docs/functions/beta-v1-diff#storage

You should change from 您应该从

exports.generateThumbnail = functions.storage.object().onFinalize((object) => {

to

exports.generateThumbnail = functions.storage.object().onFinalize((object, context) => {

and adapt accordingly the lines based on object, following the doc. 并根据文档根据对象调整行。

暂无
暂无

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

相关问题 Firebase HelloWorld的云功能“错误:发生意外错误。” - Cloud Functions for Firebase HelloWorld “Error: An unexpected error has occurred.” Firebase Cloud Function 部署时出现“错误:发生意外错误”。 - Firebase Cloud Function deploy with "Error: An unexpected error has occurred." Firebase:发生意外错误? 基本设置不起作用 - Firebase: An unexpected error has occurred? Basic setup not working Firebase-部署期间出现错误的问题:错误:发生了意外错误 - Firebase - Issue during deployment getting error : Error: An unexpected error has occurred 由于发生内部服务器错误,无法显示该页面。 Node.js 天蓝色 - The page cannot be displayed because an internal server error has occurred. Node.js azure 使用 nodejs 的 IBM DB2 抛出连接错误,如“SQL1042C 发生意外系统错误。 SQLSTATE=58004” - IBM DB2 using nodejs is throwing connection error as “SQL1042C An unexpected system error occurred. SQLSTATE=58004” Firebase 云函数:“解析 function 触发器时出错” - Firebase Cloud Functions: 'Error occurred while parsing your function triggers' Firebase 函数部署:错误 3 - 请求有错误 - Firebase Functions Deploy: Error 3 - The Request has errors Firebase 云函数部署错误 - SyntaxError: Unexpected token '?' - Firebase Cloud Functions Deploy Error- SyntaxError: Unexpected token '?' Firebase函数获取文本响应错误“ JSON中的意外令牌H” - Firebase Functions get text response error “Unexpected token H in JSON”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM