0

I'm using Next.JS SSR with firebase storage which loads images in the backend using firebase-admin(getSignedUrl) and in the browser with firebase-client (getDownloadUrl). This causes the images in the page to load twice with both generated urls.

Is there anyway to fix this?

Sanka Darshana
  • 1,391
  • 1
  • 23
  • 41
  • 1
    I wrote some general approaches below. If that's not enough to come to a solution, I'd recommend showing the [minimal code that reproduces the problem](http://stackoverflow.com/help/mcve) so folks can make recommendations based on thaat. – Frank van Puffelen Oct 28 '20 at 02:26

1 Answers1

1

You'll need to figure out why you know that two of those URLs are the same, and then translate that into code.

For example: if you know the path of the image, you might be able to use that to determine whether you need to stub out the URL from the server for one from the client.

Alternatively, you could generate a download URL on the server, with the trick shown in this answer: https://stackoverflow.com/a/43764656

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • thanks for the answer. I actually did see that answer. Is it recommended to custom make the URL that way? I'll try that. It would make it much easier. – Sanka Darshana Oct 28 '20 at 03:18