firebase / firestore-bundle-builder

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initialize storage object from admin in order to enable access to buckets

Spitzbua opened this issue · comments

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.<anonymous> (/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.<anonymous> (/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:

const bucket = new Storage().bucket(BUNDLE_STORAGE_BUCKET);

I'm getting the same issue. It's a shame they released this extension without actually getting it working correctly.

Has anyone found a way around this? I am getting same "Error: No such object" error in logs of serve function, with nothing created in storage. @dackers86?

I deleted the "fileCache" parameter and now the log "spec: " has changed to "spec: null", no "file cache: HIT", and still returns 404.

for my case to get it work, i just removed the fileCache parameter and it worked, but the whole point is to cache the bundle in storage