Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Facebook Gameroom : Error : Error when creating request. POST request with a zero-sized post buffer

Discussion in 'Windows' started by Meltdown, May 19, 2017.

  1. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    I'm testing the payments for Facebook Gameroom, and according to their Payments Lite documentation, once a product has been purchased, and its a consumable, I need to consume it, before it can be bought again.

    I've gotten everything working, the purchase works fine, but when I come to the part where I want to consume the purchased item, their documentation states...

    Code (CSharp):
    1. FB.API(
    2.   "/YOUR_PURCHASE_TOKEN/consume?access_token=YOUR_ACCESS_TOKEN",
    3.   HttpMethod.POST,
    4.   this.consumeCallback // callback that receives a IGraphResult
    5. );
    I have replaced YOUR_PURCHASE_TOKEN with the purchase token from the transaction, and the YOUR_ACCESS_TOKEN with the user access token.

    But I get the following error...

    Error : Error when creating request. POST request with a zero-sized post buffer is not supported.

    Any idea what could be causing this?

    I'm using Unity 5.6.1f1, and its using the 'custom Facebook SDK' as indicated in the player settings...

     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,722
    Can you show the detail error that you get?
     
  3. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    This is happening in the editor...

    Error when creating request. POST request with a zero-sized post buffer is not supported.

    It is the error I get back from the Facebook API.

    How can I get more detail?
     
  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,722
    Is there a stack trace available?
     
  5. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    This is from the log, sorry, I am getting this error in the Gameroom client, not the editor...

    Here is the stack trace from the log in the Gameroom client...

    Error : Error when creating request. POST request with a zero-sized post buffer is not supported.
    0x01447A7B (supertrucks)
    0x014491D0 (supertrucks)
    0x01314EEA (supertrucks)
    0x00EE36AB (supertrucks)
    0x00EE3A9A (supertrucks)
    0x012A3A6C (supertrucks)
    0x06817F5D (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,string,UnityEngine.Object)
    0x06817EFE (Mono JIT Code) [DebugLogHandler.cs:9] UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
    0x06817DC1 (Mono JIT Code) [Logger.cs:41] UnityEngine.Logger:Log (UnityEngine.LogType,object)
    0x06838929 (Mono JIT Code) [DebugBindings.gen.cs:103] UnityEngine.Debug:Log (object)
    0x26E7C1B0 (Mono JIT Code) [CashManager.cs:213] CashManager/<BuyCashPack>c__AnonStorey3:<>m__1 (Facebook.Unity.IGraphResult)
    0x26E70DD1 (Mono JIT Code) Facebook.Unity.AsyncRequestString/<Start>c__Iterator0:MoveNext ()
    0x0682D1BF (Mono JIT Code) [Coroutines.cs:17] UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
    0x0682D264 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_object_intptr (object,intptr,intptr,intptr)
    0x100F1808 (mono) mono_set_defaults
    0x1005D887 (mono) mono_runtime_invoke
    0x010AB550 (supertrucks)
    0x010A7488 (supertrucks)
    0x00F66CA3 (supertrucks)
    0x00F67CE3 (supertrucks)
    0x00F68828 (supertrucks)
    0x0130818A (supertrucks)
    0x00CD8141 (supertrucks)
    0x012F2BC0 (supertrucks)
    0x00A37ED3 (supertrucks)
    0x014844A8 (supertrucks)
    0x014C5813 (supertrucks)
    0x750362C4 (KERNEL32) BaseThreadInitThunk
    0x77750FD9 (ntdll) RtlSubscribeWnfStateChangeNotification
    0x77750FA4 (ntdll) RtlSubscribeWnfStateChangeNotification

    (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
     
  6. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    Here is my code for more context...

    Code (CSharp):
    1. FB.Canvas.PayWithProductId(
    2.           productId,
    3.           "purchaseiap",
    4.           1,
    5.           null, null, null, null, null, result =>
    6.           {
    7.               if (result.Cancelled || !String.IsNullOrEmpty(result.Error))
    8.               {
    9.                   BuyCashPackFail(productId);
    10.               }
    11.               else
    12.               {
    13.                            
    14.                   FB.API(
    15.                     "/" + result.ResultDictionary["purchase_token"].ToString() + "/consume?access_token=" + Facebook.Unity.AccessToken.CurrentAccessToken.TokenString,
    16.                     HttpMethod.POST, graphResult =>
    17.                     {
    18.                         // The error comes from this line of code, graphResult.Error
    19.                         Debug.Log("Error : " + graphResult.Error);
    20.                         BuyCashPackSuccess(productId);
    21.                     }
    22.                 );
    23.               }
    24.           }
    25.         );
     
  7. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,722
  8. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,816
    This is the code sample from the Gameroom integration page for integrating the Facebook Unity SDK...

    The SDK you propose is the js SDK. In that document, it also mentions access_token as a parameter, and I am passing this in my code. Unless I misunderstand what you are saying?

    Also, I found a lot of this documentation out of date, who should be maintaining it?
     
  9. gydronik

    gydronik

    Joined:
    Oct 20, 2012
    Posts:
    8
    Hi
    WWWForm form = new WWWForm();
    form.AddField("access_token",AccessToken.CurrentAccessToken.TokenString);
    FB.API(
    "/" + (string)FBpurchase["purchase_token"] + "/consume",
    HttpMethod.POST,
    this.consumeCallback, // callback that receives a IGraphResult
    form
    );