NIFCLOUD-mbaas / ncmb_unity

ニフクラ mobile backend Unity SDK
Apache License 2.0
55 stars 23 forks source link

4.0.1/ログインユーザを2回以上更新するとエラー #149

Closed analogsoftgithub closed 4 years ago

analogsoftgithub commented 5 years ago

不具合の概要(Description of bug)

  1. 「クイックスタート」の手順に従い環境を整える。
  2. NCMBSettingsオブジェクトに、下記のスクリプトをアタッチして実行する。
using NCMB;
using NCMB.Tasks;
using UnityEngine;

public class NCMBTest : MonoBehaviour {
    private async void Start() {

        await NCMBUser.LogOutTaskAsync();

        NCMBUser user = new NCMBUser();

        user.UserName = "Yamada Tarou";
        user.Password = "password";
        user.Add("phone", "987-654-3210");

        await user.SignUpTaskAsync();

        //987-654-3210と表示される
        Debug.Log(user["phone"]);

        NCMBUser currentUser = await    NCMBUser.LogInTaskAsync("Yamada Tarou", "password");

        currentUser["phone"] = "987-654-0123";

        currentUser = await currentUser.SaveTaskAsync();

        //987-654-0123と表示される
        Debug.Log(currentUser["phone"]);

        currentUser["phone"] = "987-654-2222";

        //エラー発生
        //StatusCode:403
        //Error:NCMB.NCMBException: sessionToken must not be entered.
        //ResponseData:
        currentUser = await currentUser.SaveTaskAsync();

        Debug.Log(currentUser["phone"]);
    }
}
NCMBException: sessionToken must not be entered.
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <7d97106330684add86d080ecf65bfe69>:0)
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) (at <7d97106330684add86d080ecf65bfe69>:0)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) (at <7d97106330684add86d080ecf65bfe69>:0)
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) (at <7d97106330684add86d080ecf65bfe69>:0)
System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () (at <7d97106330684add86d080ecf65bfe69>:0)
NCMBTest+<Start>d__0.MoveNext () (at Assets/Scripts/NCMBTest.cs:36)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <7d97106330684add86d080ecf65bfe69>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <7d97106330684add86d080ecf65bfe69>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at C:/buildslave/unity/build/Runtime/Export/Scripting/UnitySynchronizationContext.cs:115)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

-原因の可能性 2回目のPUTのログが

url:https://mbaas.api.nifcloud.com/2013-09-01/users/Jw73knBE9p31OYxh
type:PUT
content:{"sessionToken":"mj7et4qoWRfbEFFBcKXeqYLS4","phone":"987-654-2222"}
UnityEngine.Debug:Log(Object)
NCMB.Internal.NCMBDebug:Log(String) (at Assets/NCMB/Script/NCMBDebug.cs:44)
NCMB.NCMBObject:Save(NCMBCallback) (at Assets/NCMB/Script/NCMBObject.cs:960)
NCMB.Tasks.NCMBUserTaskExtension:SaveTaskAsync(NCMBUser) (at Assets/NCMB/Script/Task/NCMBUserTaskExtension.cs:38)
<Start>d__0:MoveNext() (at Assets/Scripts/NCMBTest.cs:36)
System.Threading.Tasks.TaskCompletionSource`1:SetResult(NCMBUser)
NCMB.Tasks.<>c__DisplayClass1_0:<SaveTaskAsync>b__0(NCMBException) (at Assets/NCMB/Script/Task/NCMBUserTaskExtension.cs:46)
NCMB.<>c__DisplayClass72_0:<Save>b__0(Int32, String, NCMBException) (at Assets/NCMB/Script/NCMBObject.cs:978)
NCMB.Internal.<SendRequest>d__37:MoveNext() (at Assets/NCMB/Script/NCMBConnection.cs:458)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

となっており、#143が関連している可能性が考えられます。

ncmbadmin commented 5 years ago

お世話になっております、issueをいただき、ありがとうございます。

順次、内容を確認し優先付けをおこなったうえで対応いたしますので、 今しばらくお待ちいただきますようお願いいたします。 対応次第、こちらの issue にて報告いたします。

今後とも、mobile backend どうぞよろしくお願いいたします。