Skip to content

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

@Spitzbua

Description

@Spitzbua

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions