我已将firebase-functions更新为1.0.2版,firebase-tools更新为3.18.4,firebase-admin更新为5.12.0
我正在上传一个生成从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.
答案 0 :(得分:1)
你这么说:
因此,很可能您的问题来自Cloud Functions V1.0.0及更高版本已更改的事实,请参阅文档https://firebase.google.com/docs/functions/beta-v1-diff#storage
你应该从
改变exports.generateThumbnail = functions.storage.object().onFinalize((object) => {
到
exports.generateThumbnail = functions.storage.object().onFinalize((object, context) => {
并根据文档相应地调整基于对象的线条。