extensions icon indicating copy to clipboard operation
extensions copied to clipboard

unable to use rezised images through public url

Open harshapulikollu opened this issue 5 years ago • 34 comments

[READ] Step 1: Are you in the right place?

Yes.

[REQUIRED] Step 2: Describe your configuration

  • Extension name: _ (storage-resize-images)
  • Extension version: _0.1.3

[REQUIRED] Step 3: I'm unable to access the resized images through a public(download) url from my flutter app, like I'm able to retrieve original image. I don't see any reason to use this extension if i can't access those resized images by manipulating the original Image URL.

please provide me a way how can I access those resized images from my flutter app.

harshapulikollu avatar Dec 19 '19 10:12 harshapulikollu

+1 to this. I have not found a convenient way to make the resized images publicly accessible without doing manual post-processing with additional cloud functions.

The generated thumbs have no access token visible in Firebase console, there is no clickable link to view the images, and the preview of the image never loads (infinite spinner).

Screen Shot 2019-12-21 at 10 57 12 AM

I would expect that either:

(1) there exists a simple transformation from the original firebase storage URL to access the resized images (e.g., something you could hardcode in client logic), or (2) this firebase extension comes with documentation describing how to best post-process the resized images to make them accessible

brandonpearcy avatar Dec 21 '19 19:12 brandonpearcy

+1 to this. I have not found a convenient way to make the resized images publicly accessible without doing manual post-processing with additional cloud functions.

The generated thumbs have no access token visible in Firebase console, there is no clickable link to view the images, and the preview of the image never loads (infinite spinner).

I'm facing the same issue... Seems kind of pointless at the moment to use this extension at all.

NicolasMaas avatar Dec 21 '19 22:12 NicolasMaas

Happening with me also. Works fine on "dev" project but not on "prod" project. Both projects has billing activated.

On my "dev" project, sending a new image trough firebase console or by code, it generates the public URL of the resized file.

On my "prod" project it don't work.

  • Original file on prod project
  • Resized filename: 4433b4d7-f058-4aae-8faf-ffd11c42a4dd_650x500.jpg
  • Storage file: gs://guess-where-i-am.appspot.com/images/4433b4d7-f058-4aae-8faf-ffd11c42a4dd_650x500.jpg

The process full log:

Where-Am-I_–Functions–_Firebase_console

A console print with infinite loading:

Where-Am-I_–_Firebase_console

TiagoGouvea avatar Jan 02 '20 14:01 TiagoGouvea

Just FYI, I'm following along on this thread. I'm hoping a solution is found soon. Thanks

smbowler avatar Jan 06 '20 18:01 smbowler

Hi @Ehesp, happy New Year. I just wanted to check-in to see if there was a solution to this issue. It seems to be the same issue presented in #155

My development team paused development on our own solution when we found the firebase photo-resizing extension, but are awaiting your response to these two issues before we dedicate time to implementing and debugging.

Any insight would be greatly appreciated. Thank you!

smbowler avatar Jan 07 '20 21:01 smbowler

I am also wondering this. Also wondering about the lack response here...

lars-sorensen avatar Jan 16 '20 14:01 lars-sorensen

In my backend I generate signedUrls dont like this way but also is weird that in my frontend I need to delay the get of resized images because it return to me 404 if not delay it for 2000 (the next times to access to resized images works without delay...). When the original file works like a charm with signedUrl ...

First call is original file the second is the resized: image

for (const resizeFile of urisArray) {
          const bucketFile = this.storage.file(resizeFile);
          const result = await bucketFile.getSignedUrl({
            action: 'read',
            expires: '01-01-2050',
          });
          resizedImages.push(result[0] ? result[0] : '');
        }

anthowm avatar Jan 23 '20 01:01 anthowm

In the extension configuration steps within the firebase console, there needs to be an option to enable the access token for the created thumbnails or could/should even be defaulted to a valid access token similar to behavior of the regular file upload to storage.

This is crucial for being able to use this extension. Was searching on how to use the created thumbnails and have only hit dead ends. I am not sure which use case is currently being solved with this extension if the generated thumbnails are not available for use? Seems we have to go another direction for thumbnail generation for now. If anyone has any ideas how to access the thumbnails please ping me. Anyhow looking forward to future version of this image resize extension. Txs all.

NickFoden avatar Feb 09 '20 21:02 NickFoden

@NickFoden Have been stuck with this as well. My workflow is: Client upload to storage => resize extension => onStorageFinalize => cloud function to blur image & upload to storage again

So in the end, I have:

  • the original uploaded image
  • the resized images
  • the blurred images

I cannot find a solution to generate/get the downloadable URLs (containing the tokens) of the resized & blurred images in the context of my cloud function to store to my Firestore DB so I ended up with only storing the file path (the name prop. from the data object) in the DB and doing getDownloadURL on the client-side with the firebase client SDK, which is not ideal tho but is the only way I have found so far.

lsps9150414 avatar Feb 11 '20 08:02 lsps9150414

+1 & I don't think this is a token access issue.

In my workflow, I'm serving some images & assets from a path fully open to public. ie Access rules are set to :

match /public/{allPaths=**}{
    	allow read, write;
    }

For every asset I manually construct the public url for this path, and purposely do not include any access tokens. So far all images were served just fine. However images generated by this extension are not served.

Unfortunately that's a deal killer for me, so i will have uninstall this extension & write my own image resizer. dread

DhavalW avatar Feb 28 '20 19:02 DhavalW

If you go find the new asset in your storage you can see the issue. Say you upload random.png go view in the web console and find it in storage. Expand file location and see an Access token

image

Now do the same thing for the generated thumbnail say random_200x200.png. There is no access token set, and so you will get a 403 trying to use it in your application unless you go enable it's access token manually. But no way I can do this for every single crop being uploaded. This was my experience a few weeks back trying this out. Will need to have the access token set up when the cropped image is created, same as a normal image uploaded gets a working access token.

NickFoden avatar Feb 28 '20 19:02 NickFoden

@NickFoden Yep. tried that just afterwards and you're right - it works once the token is enabled. & since its manual, doing so at scale is simply not an option.

But why does it occur even when auth requirements are disabled in rules ? that doesn't make sense. All other images on that path get served just fine without a token.

Also shouldn't this issue be marked as a bug ?

DhavalW avatar Feb 29 '20 09:02 DhavalW

Implementation/fix details are being discussed. Once a decision has been made, I'll update this issue... Thanks for your patience!

Ehesp avatar Mar 05 '20 12:03 Ehesp

signedUrl error log with non exist token status

@anthowm same case here.

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.

dfdgsdfg avatar Mar 31 '20 08:03 dfdgsdfg

Hello,

No news ? :)

QuentinSc avatar Mar 31 '20 14:03 QuentinSc

+1 waiting for a fix

On Tue, 31 Mar 2020 at 20:26, QuentinSc [email protected] wrote:

Hello,

No news ? :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/firebase/extensions/issues/140#issuecomment-606679532, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRLL6H4ITQNE6PTZQAASXTRKIADJANCNFSM4J5BQBPA .

DhavalW avatar Mar 31 '20 18:03 DhavalW

this fix worked for me https://stackoverflow.com/questions/59072882/cloud-functions-resized-images-not-loading/61023298#61023298

K0EZ avatar Apr 04 '20 04:04 K0EZ

How is this not fixed yet, I thought this extension solved all my avatar issues. But without the tokens it's useless.

The solution from @K0EZ worries me if the function code gets somehow gets updated by Firebase on a new version?

Feels like a no brainer to just make this a config option in the extension options...? Who has the usecase to automatically generate resized images you can't use?

EDIT Looks like this just happened to me, the cloud function code changed and reverted to what it was where it deleted the commented out line. Seriously need a fix...

Why is this here without being configurable https://github.com/firebase/extensions/blob/master/storage-resize-images/functions/src/index.ts#L203

sitefinitysteve avatar Apr 16 '20 23:04 sitefinitysteve

Submitted a PR to block the delete based on a config option, no idea if it'll get approved though...

sitefinitysteve avatar Apr 22 '20 14:04 sitefinitysteve

Thanks for the contribution @sitefinitysteve, the reason why we took so long was because we didn't realize that the issue was simply that we should not be deleting the download token from the metadata. Thanks for providing the helpful Stackoverflow link @K0EZ !

laurenzlong avatar Apr 22 '20 19:04 laurenzlong

Yeah the PR is especially considerate, to even ask the user if they want to delete the token. But pretty sure can just remove that one line

delete metadata.metadata.firebaseStorageDownloadTokens;

And everyone can finally use this extension. Unless maybe someone does need to hide their thumbnails, but not the originals? (Seems like that would be a rare use case.)

NickFoden avatar Apr 22 '20 19:04 NickFoden

I have found the solution to it like i have to comment out the line which deleting the access token in the cloud function and now i have access to token of image after resizing but there is problem that if i have to change the configurations of extension the code is updated in cloud function so i have to change this line every time i change the configuration. this solution works for me well but its not a solid solution.

its simple process

  1. after installing the extension go to functions
  2. then select view details usage its opens a screen from where you have to select source vd
  3. form source find file named FUNCTIONS/LIB/INDEX.JS , Go to line 152 then comment this out code on line 152 : delete metadata.metadata.firebaseStorageDownloadTokens; file

Mian-Zaid avatar Apr 23 '20 05:04 Mian-Zaid

Thanks everyone! I think we pushed a commit last week that fixed this. Please let us know if you continue to see issues!

karayu avatar May 18 '20 21:05 karayu

I just installed this extension, and by default it looks like the resized images don't have tokens, so I can't see them in the Firebase Console. Is that expected?

devth avatar Mar 27 '21 05:03 devth

Yes same for me I don't have the public token url

felix-lambert avatar Aug 05 '21 09:08 felix-lambert

Hi @devth @felix-lambert

I'll reopen this issue for investigation.

dackers86 avatar Aug 05 '21 10:08 dackers86

Hi @devth @felix-lambert.

I am currently unable to replicate a missing token, can you confirm which version of the extension you are using?

The latest version is currently [email protected]

dackers86 avatar Aug 09 '21 13:08 dackers86

Hello thanks for your help. Yes I can confirm that the public token url is not available on the resized image in version 0.1.22. I only have the storage (gs://....png) but not the access token. The image with the original size has the access token but not the resized image.

felix-lambert avatar Aug 10 '21 14:08 felix-lambert

Can you confirm that the File location tab on the right does not contain a token in Firebase storage?

Apologies if I am looking in the incorrect location.

dackers86 avatar Aug 10 '21 14:08 dackers86

I have a file location tab. It contains: gs://.../mint.png for example but I don't have an Access token tab on the right for the resized image.

felix-lambert avatar Aug 10 '21 15:08 felix-lambert