I am making a thumbnail image using firebase functions, however, I tried two approaches to get the downloadURL of the resulted image but both I have different problems:
The first approach: I used the code below
const signedUrls = await bucket.file(thumbFilePath).getSignedUrl({
action: "read",
expires: "03-09-2491"
});
For this approach after some days, the url is no more valid even though the expiration date is very far, I couldn't find a proper solution and in meanwhile, I found another approach so I tried it.
the second approach: I used the code below
// Uploading the thumbnail than make it public to be able to access it.
await bucket.upload(tempFilePath_des, {
destination: thumbFilePath,
metadata: metadata
});
await storage
.bucket(fileBucket)
.file(thumbFilePath)
.makePublic();
thumbURL =
"https://storage.cloud.google.com/" + fileBucket + "/" + thumbFilePath;
This approach works well when I use Google Auth, but when I use email auth the following error is thrown:
Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type text/html. See for more details.
Please, Any help?