尝试使用Firebase功能移动Firebase存储文件时出现ApiError

时间:2018-03-19 17:46:00

标签: javascript firebase google-cloud-storage google-cloud-functions firebase-storage

我正在尝试使用函数移动Firebase存储文件。我在这几个小时,但无论我做什么,我都变得非常奇怪 ApiError

最简单的代码版本:

const admin = require('firebase-admin')
const storageRoot = admin.storage().bucket()

exports.moveFile = (oldPath, newPath) => {
    return storageRoot.file(oldPath).move(newPath)
}

此代码导致的错误:

ApiError: Not Found
at Object.parseHttpRespBody (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/common/src/util.js:199:30)
at Object.handleResp (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/common/src/util.js:137:18)
at /user_code/node_modules/firebase-admin/node_modules/@google-cloud/common/src/util.js:502:12
at Request.onResponse [as _callback] (/user_code/node_modules/firebase-admin/node_modules/retry-request/index.js:195:7)
at Request.self.callback (/user_code/node_modules/firebase-admin/node_modules/request/request.js:186:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (/user_code/node_modules/firebase-admin/node_modules/request/request.js:1163:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (/user_code/node_modules/firebase-admin/node_modules/request/request.js:1085:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)
at IncomingMessage.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:974:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
code: 404,
errors: [ { domain: 'global', reason: 'notFound', message: 'Not Found' } ],
response: undefined,
message: 'Not Found'

admin SDK初始化是不同文件中的presnet,看起来像admin.initializeApp(functions.config().firebase)任何想法非常很受欢迎。

0 个答案:

没有答案