firebase / firebase/firestore-bundle-builder
Initialize storage object from admin in order to enable access to buckets
- Dominant language
- TypeScript
- Stars
- 14
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
By setting the extension property "fileCache" the data-bundle binary should be stored on the entered bucket. On hitting the url to request generating a bundle the function crashes with following exception. I created the folder and the also the file but the error message stays the same. I checked the reqeusted url twice and it works using the https url.
I guess because the bucket is not public available? Does it only work with a bucket where public access is enabled?
`Error: No such object: placeholder.appspot.com/DataBundles/data-bundle?
at new ApiError (/workspace/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:79:15)
at Util.parseHttpRespMessage (/workspace/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:181:41)
at Util.handleResp (/workspace/node_modules/@google-cloud/storage/build/src/nodejs-common/util.js:155:76)
at Duplexify. (/workspace/node_modules/@google-cloud/storage/build/src/file.js:1007:38)
at Duplexify.emit (events.js:400:28)
at Duplexify.emit (domain.js:537:15)
at PassThrough.emit (events.js:400:28)
at PassThrough.emit (domain.js:537:15)
at onResponse (/workspace/node_modules/@google-cloud/storage/node_modules/retry-request/index.js:234:19)
at PassThrough. (/workspace/node_modules/@google-cloud/storage/node_modules/retry-request/index.js:165:11)`
Initializing the storage object from the admin object should solve this issue?
Instead of using:
const bucket = new Storage().bucket(BUNDLE_STORAGE_BUCKET);
Use this one:
const bucket = admin.storage().(BUNDLE_STORAGE_BUCKET);
Mentioned code line:
https://github.com/firebase/firestore-bundle-builder/blob/807dd9ea49a90b9dc608004cc353cae06830471d/functions/src/index.ts#L26
Contributor guide
Assessment
This issue has not been assessed yet.