question

farinetti@brokenarmsgames.com avatar image
farinetti@brokenarmsgames.com asked

Problem uploading a file trough CloudScript

Hi,

I'm using CloudScript to connect to an external service (BackBlaze) to store a file with data info on the game, here below the snipper of code I'm using:

 

var headers = {};
headers["Authorization"] = uploadToken;
headers["X-Bz-File-Name"] = "test.txt";
headers["Content-Length"] = 3;
headers["Content-Type"] = 'text/plain';
headers["X-Bz-Content-Sha1"] = "a9993e364706816aba3e25717850c26c9cd0d89d";

log.debug(uploadUrl);
log.debug(uploadToken);

var aaa = http.request(uploadUrl, "POST", "abc", "text/plain", headers);

 

I retrieve both uploadUrl and uploadToken from others API (that's why I can't copy them in), the data format is correct bul always returns me an error, saying that "The script made an external HTTP request, which returned an error." but I can't see any of the third party API error code.

If I try the same call from Postman, it goes trough without any problem, is it possible that PlayFab wraps the other service error response? How do I read the actual one? 

 

Thanks

Elisa

10 |1200

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

brendan avatar image
brendan answered

What exactly are you getting back in aaa when it is stringified? Can you give us examples of what you expect to be in the uploadUrl and token? Also, can we test on your title, to see what errors we can see (and is this Title ID 4353)? Also, please note that setting Title Data as a result of a user action in Cloud Script isn't recommended, as you will have cases where multiple players are attempting to update the data at the same time.

10 |1200

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

farinetti@brokenarmsgames.com avatar image
farinetti@brokenarmsgames.com answered

You can test it from our title(4353), the method is WriteReplay, please use player 81A73A09E15E3245 to test, passing those as arguments:

'scenary': 'Scenario02',
'level' : '010',
'string' : 'abc',
'sha1': 'a9993e364706816aba3e25717850c26c9cd0d89d'

If there is any error in the data format, I should receive something back from BackBlaze service as:

{
    "status" : 400,
    "code" : "invalid_bucket_name",
    "message" : "bucket name is too long"
}

 

10 |1200

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

brendan avatar image
brendan answered

The first problem I see is that at least one of your Title Data elements is over 100 KB. The limit for Title Data is actually 10 KB (https://playfab.com/limits/). If you want to use larger data blobs, I would have to recommend using our Content service, instead. We'll be providing an upgrade system shortly, which will allow you to select higher limits where needed, but using Content would be more cost-effective for you, so that would be my recommendation there. You'll definitely need to correct that, as one step.

In testing the actual call, the error being returned by BackBlaze is in the Error level data in your log. Specifically, this part:

"result": {
"responseContent": null,
"httpStatus": null,
"httpStatusCode": 0,
"requestError": "InternalError"
},

An InternalError tells us that there was an error processing this in BackBlaze, but they're not providing any additional information on what that error is. This is often the catch-all error for unexpected failures in service API calls. I would have to recommend reaching out to the BackBlaze team directly, to get more info on the error that is occurring in your test.

10 |1200

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

farinetti@brokenarmsgames.com avatar image
farinetti@brokenarmsgames.com answered

Thanks for your feedback, how do I check my TitleData dimension? there is any panel where I can see it?

10 |1200

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

brendan avatar image
brendan answered

Yes, you can see and edit your Title Data in the Game Manager by clicking on Settings and then the Title Data tab within Settings.

10 |1200

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

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.