question

Tobias Lint avatar image
Tobias Lint asked

Uploading Images to CDN with CloudScript,

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!

,

CloudScriptContent
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

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.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Tobias Lint avatar image Tobias Lint commented ·

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

0 Likes 0 ·
Tobias Lint avatar image Tobias Lint commented ·

Thank you, I implemented it and it works just fine ;)

0 Likes 0 ·
esk avatar image esk commented ·

Can't a hacked client also just modify the cloudscript request in the same way and upload anything it wants?

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ esk commented ·

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.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.