I´m trying to uninstall a resize image firebase extension, but it's showing some error message:
ext-storage-resize-images#zzz.iam.gserviceaccount.com","status":"INVALID_ARGUMENT","statusMessage":"Bad Request","requestPath":"https://cloudfunctions.googleapis.com/v1/projects/zzz/locations/us-central1/functions","httpMethod":"POST"}}
Firebase console logs
{"#type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{"code":3,"message":"Invalid function service account requested: ext-storage-resize-images#zzz.iam.gserviceaccount.com"},"authenticationInfo":{"principalEmail":"1072297581434#cloudservices.gserviceaccount.com","serviceAccountDelegationInfo":[{"firstPartyPrincipal":{"principalEmail":"cloud-dm#prod.google.com"}}]},"requestMetadata":{"callerIp":"64.233.172.179","callerSuppliedUserAgent":"Google-Deployment-Manager,gzip(gfe),gzip(gfe)","requestAttributes":{"time":"2020-07-22T15:01:22.851Z","auth":{}},"destinationAttributes":{}},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.CreateFunction","authorizationInfo":[{"resource":"projects/zzz/locations/us-central1/functions/ext-storage-resize-images-generateResizedImage","permission":"cloudfunctions.functions.create","granted":true,"resourceAttributes":{}}],"resourceName":"projects/zzz/locations/us-central1/functions/ext-storage-resize-images-generateResizedImage","request":{"#type":"type.googleapis.com/google.cloud.functions.v1.CreateFunctionRequest","location":"projects/zzz/locations/us-central1","function":{"serviceAccountEmail":"ext-storage-resize-images#zzz.iam.gserviceaccount.com","eventTrigger":{"resource":"projects/_/buckets/zzz.appspot.com","eventType":"google.storage.object.finalize"},"runtime":"nodejs8","description":"Listens for new images uploaded to your specified Cloud Storage bucket, resizes the images, then stores the resized images in the same bucket. Optionally keeps or deletes the original images.","entryPoint":"generateResizedImage","sourceArchiveUrl":"gs://firebase-mod-sources-prod/a139bcfefbf19e901b67789105a3841ed208c6e449a896bafcc4a01e43c07844","availableMemoryMb":1024,"name":"projects/zzz/locations/us-central1/functions/ext-storage-resize-images-generateResizedImage","labels":{"deployment-tool":"firebase-extensions","goog-firebase-ext":"storage-resize-images","goog-firebase-ext-iid":"storage-resize-images"}}},"resourceLocation":{"currentLocations":["us-central1"]}}
Related
Hello I am trying to upload a second app in the same app Firebase but they always show me Error 4 in their pictures, when trying to enter with a google account
Although I do not have problems to enter with the same user and account that I gave them.. Of course I change the Json file to the second app , as I said I can log in without problems but they cannot.
In our system the users upload their images using our mobile app to firebase storage which is a wrapper over google cloud storage bucket, the mobile app is using this library to do the upload, and then use the getDownloadUrl method (described in the link) to generate a download link like the following:
https://firebasestorage.googleapis.com/v0/b/{BUCKET_NAME}/o/{PARENT_FOLDER}/{IMAGE_NAME}?alt=media&token={UUID}
Then it sends the URL to our BE to store the link.
The download time for firebase storage links is much longer than downloading the exact same image directly from google cloud storage link which is simply could be generated from the following link template
https://storage.googleapis.com/{BUCKET_NAME}/{PARENT_FOLDER}/{IMAGE_NAME}.
As GCP link is faster (according to our own benchmark), then we need a way to map firebase link into its counter part in GCP storage to improve the download performance.
The solution described above to do the mapping is right for any image that is publicly available in the GCP bucket, however, if the image is not publicly available then it could be accessed using firebase link (maybe because it has the token in the link), but we can not access it using the GCP link and it gives the following error:
<Error>
<Code>AccessDenied</Code>
<Message>Access denied.</Message>
<Details>Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object.</Details>
</Error>
My question is:
How can we access the image from GCP storage link, even if it is not public, given that we can not make all images public due to security reasons?
How can I retrieve Firebase storage image in flutter without getting downloadUrl and display it within some image compatible widget. I don't want my users to anyhow see download url even if they open my code
If you're using the FlutterFire Storage library in your app, you can call getData on a reference to the file to get its data. So with that you just need to know the path to the data, and you won't need the download URL in your application. Once you have the data locally, you can create an image out of it with: Converting a byte array to image in Flutter?
Unlike download URLs, the call to getData() is checked by security rules, so you'll have to ensure that the user is permitted to access the file.
I tried to install the storage-resize-images extension, but received the following error:
Error occurred while deploying resources: RESOURCE_ERROR:
/deployments/firebase-ext-storage-resize-images/resources/generateResizedImage
{"ResourceType":"gcp-types/cloudfunctions-v1:projects.locations.functions","ResourceErrorCode":"400","ResourceErrorMessage":"Cloud
Storage trigger bucket [MY BUCKET NAME] not found"}
The key part of that error message is:
Cloud Storage trigger bucket [MY BUCKET NAME] not found
There are a couple of possible causes:
Cloud Storage for Firebase isn't set up in the project yet, so the bucket doesn't exist. To check if this is the case, head to the Storage tab of the Firebase console. If you see Get Started instead of a view of a Storage bucket, click Get Started to create the default bucket.
If you want to use a different bucket with the extension, click the three-dot menu in the top right corner of the Storage explorer, and click Add Bucket.
The bucket name is malformed. It needs to be of the form [bucket-name].appspot.com. For example, my-bucket.appspot.com
I have a Firebase storage bucket that has the default security rules, only authenticated users can upload their files to the bucket. But this security rule seems to only apply when my web application when it is being viewed from my laptop and I am actually able to upload data and files to Firebase database and storage bucket without logging in on my phone. Is this a bug?
Because when I upload a file from my laptop, without logging in it says:
Uncaught FirebaseError: Firebase Storage: User does not have permission to access 'images/wppr.jpg'.
This prevents the upload of files and data to the database and the storage bucket, only on my laptop. Not on my phone.
Same application. Same security rules. Two different devices and two separate behaviors.
EDIT
I did not change the security rules on my Firebase storage project. This is how it happened, I kept some UI which the user can use to upload some files to Firebase storage but only if they are logged in. This worked on my laptop but not on my phone. This only happened when I log in, upload some files, then exit the web app without logging out and then when I go back into my web app, the onAuthChanged function displays UI that should be displayed when a user is logged out (implying that I am not logged in), but I can upload files successfully. This does not happen when I log in, upload files, log out and then try to upload some files without logging in.
EDIT 2
I have also found this to happen when I refresh the web app on my laptop without logging out. I am able to upload files. Why is this happening?