Hello,
I'm trying to store Images on CDN by managing them with CloudScripts.
I have already set it up, and it works just fine when I run it locally. But now I wanted to test it in the Cloud and got this Error: "CloudScriptAzureFunctionsArgumentSizeExceeded"
I guess this is because I am sending the Image within the FunctionParameter and if the function is run in the Cloud there is a limit? I find it a bit disappointing that this was error was not raised when I run locally...
Has anybody an Idea how I can pass the Image to the CDN without using an dedicated server or enabling AdminFunctions on the client?
Thanks a lot!
,
Answer by Brendan · Dec 18, 2020 at 03:20 AM
You would need to write the image to an Entity File, and then pass the info about that file into the script. Either that, or pass the upload URL to the source (presumably the client). But I can't really recommend that path, since it would be trusting the client to upload a legitimate image file (a hacked client could upload anything it wanted to). At least having the script in that flow would allow you to do some basic checks of the data before committing it to CDN.
Thank you, I will check this solution out. I get that a hacked client may upload anything over this but I have only one cloud function that can upload a file and there are many checks on that data. For now I have a data limitation of 200Kb and its running through the Azure ContentModerator for an NSFW check. Do you think this is enough?
Thanks for the answer
Thank you, I implemented it and it works just fine ;)
Can't a hacked client also just modify the cloudscript request in the same way and upload anything it wants?
It is possible. Hence it is important to have verification steps before any data is changed on PlayFab. For example, Cloud Script/Azure Function has context in the argument, where caller information is stored. you may check the if this execution is valid to this player by reading values in context variable.
Updating Character Statistics Cloudscript 2 Answers
Several questions related to Cloud Script & CDN 1 Answer
Azure Function failed calling via Rules 2 Answers
Attach URL at runtime to custom email template using cloud script 1 Answer
How do I RegisterPlayFabUser from CloudScript,How do I register a new user from inside cloudscript 2 Answers