0

I would need some method on the server side (cloud function) to give me a 'changing' url when an image is updated with same file name. Is that possible?

Background: I use the recent firebase extension to create thumbnails. When thumbnails are generated, I store the download urls on firestore for access in my mobile app

As per difference between getSignedUrl() and getDownloadUrl() I use getSignedUrl().

But this method gives me 'same' url even when the underlying image changes. And because the url is same the Widget (I use flutter) does not re-build and the modified image is not reflected

exports.thumbnailHandler = functions.storage.object().onFinalize(async (object) => {
  const contentType = object.contentType;
  const filePath = object.name;
  const fileBucket = object.bucket;
  const fileRef = admin.storage().bucket(fileBucket).file(filePath);

  const options = {
      action: 'read',
      expires: '12-31-2099'
    };

  fileRef.getSignedUrl(options).then(results => {
      var downloadUrl = results[0];
      console.log(downloadUrl); //This is same url everytime, even when image changes but with same file name
  }

}

Is there an alternative to signedUrl above something equivalent to downloadUrl from flutter sdk?

Update This is the answer: This gives me the downloadUrl as I would from a client https://stackoverflow.com/a/53744579/11749006

0 Answers0