I\'ve uploaded an image to Cloud Storage , but I\'m having an issue with displaying an image. On the Storage overview, I\'m getting Error loading preview.
I haven\'t
Can you see an Access token if you click the File location section there in your Console? If not, this could be an issue with the fact that your file does not contain an "Access token".
Try adding one in the metadata and see how it goes.
const metadata = {
contentType : `${imageType}`,
firebaseStorageDownloadTokens: uuidv4() //In this line you are adding the access token
};
See, whenever you upload an image using Firebase Console, an access token will be automatically generated. However, if you upload an image using any Admin SDK or gsutil you will need to manually generate this access token yourself.
This curious fact seems to affect the preview in the Firebase Console.
For example, I uploaded the same image using the Admin SDK and the Console and here are the results.
Uploaded using Admin SDK (It keeps loading forever):
Uploaded using the Console (Has an access token in the File location section)
I am aware that this error looks a little bit different but could be related. Good luck!
I addressed this issue in this question for Python