question

brendan avatar image
brendan asked

Http 404 not found when running a cloud script

he2
started a topic on Tue, 21 April 2015 at 8:33 AM

Hello,

I'm currently working on a cloud script on my app. After login and asking the cloud script url (with api:LoginWithPlayFab and api:GetCloudScriptUrl) I receive a correct session id and a correct url. But each time I test a function, even a very very basic one like, for example :

handlers.TestAlive = function (args) {
    var message = "Hello " + currentPlayerId + "!";
    return { messageValue: message };
}

I always have the same returned code : http 404 not found.

Do I need to have a premium licence to run small scripts on a server or the basic one is ok ? Or do I miss something ?

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

Best Answer
he2 said on Wed, 22 April 2015 at 12:59 PM

After reading my code I found the solution, I post the answer, may be this will help someone stuck on the same problem.

I was posting to the following url : "https://[TitleID].playfablogic.com/1/prod" + operationString

For some terrible reason, the std::string operationString was cleared by a wrong operation, so instead of posting to the correct url :

https://[TitleID].playfablogic.com/1/prod/Client/RunCloudScript

I was posting :

https://[TitleID].playfablogic.com/1/prod

And I of course receive the error http code 404

Anyway, thanks for the answers I've received and for the time spend.


6 Comments
johntube said on Tue, 21 April 2015 at 10:13 AM

Please be sure that your CloudScript revision that contains the "TestAlive" handler is deployed !


he2 said on Tue, 21 April 2015 at 10:38 AM

Unfortunatly, i'm sure about that :(

I've deployed the correct script.


Brendan Vanous said on Tue, 21 April 2015 at 4:25 PM

A 404 would indicate that the endpoint being called is incorrect. It should look like either https://{TitleID}.playfablogic.com/1/prod or https://{TitleID}.playfablogic.com/1/test, depending on whether you had Testing set to true in the call to GetCloudScriptUrl (and please don't depend on the numeric value always being 1 - you should always query the URL on startup of the title.

If you're using one of our SDKs, the call to GetCloudScriptUrl fills in the URL so that when you call RunCloudScript it should work fine. Otherwise, you would need to ensure that you're calling the correct endpoint. Can you let us know which SDK you're using (if any), and provide the snippet showing how these calls are being made?

For completeness, if you make a call to a Version which doesn't exist, you'll get a JavascriptException error, with details beginning "Exception: No cloud logic version: " and the version you specified. And if you make a call to a handler which doesn't exist in your script, you'll get a CloudScriptNotFound error.

Brendan


he2 said on Wed, 22 April 2015 at 4:49 AM

I'm using GetCloudScriptUrl and this command return an url with the following syntax :

{ 

    "code": 200,

    "status": "OK",

    "data": {

        "Url": "https://[TitleID].playfablogic.com/1/prod"

    }

}

I can log / create account, make any operation, it works, but I always have 404 error when I use RunCloudScript. I still don't get it. Btw i'm using the starter edition (the free one) but is it a problem ?

When I call the client op, here is what I have :

https://[TitleID].playfablogic.com/1/prod

{

    "ActionId": "TestAlive",

    "ParamsEncoded": ""

}

with the correct session key. I use iwHttp class provide by marmalade api. Everything works except this terrific RunCloudScript function ^^


he2 said on Wed, 22 April 2015 at 12:59 PM

After reading my code I found the solution, I post the answer, may be this will help someone stuck on the same problem.

I was posting to the following url : "https://[TitleID].playfablogic.com/1/prod" + operationString

For some terrible reason, the std::string operationString was cleared by a wrong operation, so instead of posting to the correct url :

https://[TitleID].playfablogic.com/1/prod/Client/RunCloudScript

I was posting :

https://[TitleID].playfablogic.com/1/prod

And I of course receive the error http code 404

Anyway, thanks for the answers I've received and for the time spend.


Brendan Vanous said on Wed, 22 April 2015 at 2:01 PM

Great - glad to hear this is working for you. Let us know if you run into any other issues.

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.