-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinit loop with the moderate-images example #87
Comments
Hi, After digging a little bit, it seems that EDIT: I did a small trick, it's not clean but it stops the infinite loop waiting for a better fix.
And then I checked on the
Works fine, I have a log "Already blurred" and then it stops. |
The trick is nice indeed :) (good way to use metadatas) But normally the function does not run in a loop. The issue is that in your code it seems you have removed the Cloud Vision API call (this is what stops the loop) and you are always blurring the image (you were just testing this I guess). In the original sample we first check if the image is offensive and, if it is, we blur it. The function gets called again on the new blurred image but - because it's been blurred - the image is not detected as being offensive on the second check and this ends the loop. By the way be careful when using metadata because the users can set them from the client (when you upload the image) and they could use that to bypass the image check on the function. You can avoid that by using some special security rules to forbid setting the metadata from the client though. |
Thanks for your tips! I was not aware of metadata risk :) |
Hi,
I've copy/paste the moderate-images example and when I'm uploading an image in Firebase Storage, it executes the cloud function like there was a loop. To stop it, I have to comment the code and deploy again.
Here is the copy/pasted code. The only difference is that I have removed to
google-cloud-vision
part and blurred the image every time.And here is a screenshot of my dashboard when I only uploaded one image called "oss2.png"
![capture d ecran 2017-03-25 a 16 07 11](https://cloud.githubusercontent.com/assets/1591702/24323453/aedf86d0-1175-11e7-9f90-8bc19b83b375.png)
If you have any input on it, that would be great!
Thanks!
The text was updated successfully, but these errors were encountered: