question

Deekshith avatar image
Deekshith asked

Timeout error for makeHttpRequest

I am making a http request to a azure function in a cloudscript function and there is this strange thing happening which is quite rare but it does happen. I will be getting a timeout error for this makeHttpRequest.

There is no timeout for the cloudscript as I did check execution time and it was around 2 seconds and it is getting called from client side not a playstream event. Why is this error happening and how to resolve it?

Following is a small part of the error caught in catch block

cloudScriptErrorCode:CloudScriptHTTPRequestError

\"contentType\":\"application/json\",\"headers\":{},\"result\":{\"responseContent\":null,\"httpStatus\":null,\"httpStatusCode\":0,\"requestError\":\"Timeout\"},\"httpRequestError\":\"Timeout\"}
apisCloudScript
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

·
Citrus Yan avatar image
Citrus Yan answered

So this does not happen quite often, is that correct? And, as a matter of fact, there are many causes for the timeout issue: increase of traffics on the internet, Azure Function may be cold starting, etc. You may need to add some re-try mechanisms to handle this.

However, I think the main problem here is that why are you trying to call Azure Functions from CloudScript? The purpose of the new PlayFab CloudScript using Azure Functions feature is that you can have much longer-running, asynchronous and free from the API count limit calls. Calling Azure Function from legacy Cloud Script would be counterproductive, since the legacy engine may time out at times.

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.

Deekshith avatar image Deekshith commented ·
  • Yes it does not happen quite often. It rarely happens.
  • I have tried a retry mechanism which will retry once but it took another 2 seconds and still got a timeout error.
  • Yes I am calling azure function using makeHttpRequest()
  • I am not clear on the link you provided and how to use it or test it. Can you please elaborate on this?
0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Deekshith commented ·

The link is a tutorial of our new PlayFab CloudScript using Azure Functions feature where you can execute your server logic entirely on Azure Functions with PlayFab instead of using the legacy CloudScript. We recommend that you use the new feature since you already have a Azure Function Subscription and needs to call Azure Function from CloudScript.

0 Likes 0 ·
Deekshith avatar image Deekshith Citrus Yan commented ·

Ok Thanks,I will look into it. However just want to get a clear idea on why makeHttpRequest is getting timed out in such a short time?

Is there any time limit for that? Is it documented anywhere?

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.