question

ryanbernstein avatar image
ryanbernstein asked

Cloud Script: Can I use an external library?

Can I use an external library in cloud script? If not, what predefined objects are provided for me, such as the http object? I need to perform a HmacSHA256 hash and was hoping to use a premade one instead of defining my own.

CloudScript
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

For security reasons, we don't provide the ability to use modules/libraries in Cloud Script. Our Cloud Script engine is a vanilla instance of the latest V8 (https://v8.dev/), with the PlayFab Server API and a few key parameters pre-configured (https://api.playfab.com/docs/tutorials/landing-automation/writing-custom-cloud-script).

So, for any crypto, you'd want to just include that code directly in your script, since CryptoJS (for instance) isn't part of the base of V8.

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.

ryanbernstein avatar image ryanbernstein commented ·

Thank you for the fast reply. I figured as much. Are there any plans to extend the functionality of Cloud Script? Maybe to a Nodejs instance?

0 Likes 0 ·
brendan avatar image brendan ryanbernstein commented ·

Actually, the plan is to improve scripting by adding an integration to use Azure Functions. We should have more we can talk about in that space in the coming quarter.

0 Likes 0 ·
ryanbernstein avatar image ryanbernstein brendan commented ·

Good to hear! I haven't played with Azure Functions yet but if it is anything like AWS Lambda then It will be a great solution.

0 Likes 0 ·
Show more comments

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.