Code Monkey home page Code Monkey logo

Comments (12)

jhuleatt avatar jhuleatt commented on August 29, 2024 4

Maybe the extension can just call getDownloadURL after it creates the new image, but not block on that call? That way, by the time a client tries to access the image, the storage download tokens should be created.

Note: The missing firebaseStorageDownloadTokens seem to break the image previews in the Firebase console too

from extensions.

envyram avatar envyram commented on August 29, 2024 3

@rosariopfernandes that's a great discussion. "getDownloadURL() from Node" is what I am looking for actually. Without that the extension on Firebase is not quite useful

from extensions.

Ehesp avatar Ehesp commented on August 29, 2024 3

There is overlap here with issue #140 - the issue is that the Admin SDKs (in our case NodeJS) cannot call getDownloadURL, as this needs to come from a client instance. We're currently discussing the best solution/idea to handle the tokens/download URLs.

from extensions.

lsps9150414 avatar lsps9150414 commented on August 29, 2024 1

Maybe the extension can just call getDownloadURL after it creates the new image, but not block on that call? That way, by the time a client tries to access the image, the storage download tokens should be created.

Note: The missing firebaseStorageDownloadTokens seem to break the image previews in the Firebase console too

Hey @jhuleatt thanks for the summary. So is the current plan to call getDownloadURL by the extension so that we can get firebaseStorageDownloadTokens in the metadata via storage.object().onFinalize() triggers?

from extensions.

thatfiredev avatar thatfiredev commented on August 29, 2024

@envyram I'm not sure what you mean. Looking at the StorageMetadata reference I don't see any downloadTokens. Can you tell us how do you usually get this metadata? Is it custom metadata?

from extensions.

envyram avatar envyram commented on August 29, 2024

@rosariopfernandes

In firebase cloud functions:

exports.thumbnailHandler = functions.storage.object().onFinalize(async (object) => {
console.log(object.metadata.firebaseStorageDownloadTokens);
}

This is available for all of my other objects in the bucket. But is not available only for the thumbnails created from the extension

from extensions.

thatfiredev avatar thatfiredev commented on August 29, 2024

@envyram Thanks for the useful code snippet. I couldn't find this firebaseStorageDownloadTokens anywhere on the docs, and this post actually explains why:

Doug Stevenson pointed out that firebaseStorageDownloadTokens is not an official Google Cloud Storage feature. You won't find it in any Google documentation, and there's no promise it will be in future version of @Google-Cloud. I like firebaseStorageDownloadTokens because it's the only way to get what I want, but it has a "smell" that it's not safe to use.

Since this is not official, I'm not sure if we should have it on Firebase Extensions, but I'll wait for a Firebaser to decide.

from extensions.

jhuleatt avatar jhuleatt commented on August 29, 2024

I chatted with the Cloud Storage for Firebase team about firebaseStorageDownloadTokens. The field should be unique per object. If it isn't set on an object, it will be set automatically by the Cloud Storage for Firebase api when getDownloadURL() is called.

TL;DR we shouldn't copy it over in the extension.

from extensions.

thatfiredev avatar thatfiredev commented on August 29, 2024

@jhuleatt thanks!

@envyram have you tried using the Google Cloud Client Library for NodeJS? The docs contain a snippet on how to download a file:

await storage
  .bucket(bucketName)
  .file(srcFilename)
  .download({destination: 'example.jpg'});

console.log(
  `gs://${bucketName}/${srcFilename} downloaded to ${destFilename}.`
);

from extensions.

Ehesp avatar Ehesp commented on August 29, 2024

XFN Team: Couple of options available here; the extension could initialise getDownloadURL() or leave this to the user (maybe improved documentation is needed?).

from extensions.

dfdgsdfg avatar dfdgsdfg commented on August 29, 2024

signedUrl error log with non exist token status

I create signedUrl with adminStorage.bucket(bucketName).file(filePath).getSignedUrl(options), but it does not work.

<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.
</Message>
<StringToSign>
GET 1895632947 /project.appspot.com/users/NK8bDKYlaofgwkX6cxy14tqpsGa2/room_backgrounds/room_bg_1584592936559_Ib6R9sawuIQ_200x200.jpeg
</StringToSign>
</Error>

If I create access token on web ui after created signedUrl, it still does not work.

from extensions.

laurenzlong avatar laurenzlong commented on August 29, 2024

This appears to be a duplicate of #140, which will be solved by #279

from extensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.