question

Daxay avatar image
Daxay asked

Getting 503 Service Unavailable on CreateGroup using nodejs playfab-sdk from azure cloud function

I am getting below errors on CreateGroup method of PlayfabGroup in playfab-sdk nodejs.

{
  code: 503,
  status: 'Service Unavailable',
  error: 'Connection error',
  errorCode: 2,
  errorMessage: ''
}


I already set titleId and developerSecretKey in Playfab object from playfab-sdk.

PlayFab.settings.titleId = PLAYFAB_CONFIG.titleId;
PlayFab.settings.developerSecretKey = PLAYFAB_CONFIG.secretKey;

Thanks :).

apissdks
1 comment
10 |1200

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

Daxay avatar image Daxay commented ·

By doing some debugging and adding some logs, i found the exact error code from API and real reason why SDK show above errors.

It show this error whenever API is not sending proper response in JSON format.

In this case, API sends status code 500 with empty response, that's why SDK can not parse this and send this custom error.

Can you guys please check why i am getting internal server error from the API?

0 Likes 0 ·

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

This is most likely a known server issue. Could you please provide your request body? Please hide your private information.

2 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.

Daxay avatar image Daxay commented ·

Thanks for the reply,

Actually, i fixed this issue by calling PlayFabAuthentication.GetEntityToken of title's entity token before using entity.

However i found two issue to point out:-

  1. I got confused because Playfab API server sends response as internal server error when X-EntityToken is not defined or null. It should send unauthorized or bad request errors.
  2. There is no documentation that suggest that you should first need to do title entity login in case of using nodejs playfab-sdk for entity API at server side.
0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Daxay commented ·

>> I got confused because Playfab API server sends response as internal server error when X-EntityToken is not defined or null. It should send unauthorized or bad request errors.

Does this issue still exist? We can’t reproduce it in the testing title.

>> There is no documentation that suggest that you should first need to do title entity login in case of using nodejs playfab-sdk for entity API at server side.

Thanks for the suggestions. Yes, on the server side, if you want to use the title entity to access the Entity API, you need to call GetEntityToken for the title first. Expect for the documentation, the forum is also the knowledge base of PlayFab. Besides, you can try to add a feature request for such tutorials of how to use the title entity token on the server.

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.