question

warren avatar image
warren asked

UnlockContainerInstance can unlock a single-use consumable container twice

I'm not sure if this is a bug in PlayFab or if I'm doing something wrong:

I'm using consumable containers with "By Count"=1 to act as reward chests. In testing, there was a bug in our client that called PlayFabClientAPI.UnlockContainerInstance two times in fairly rapid succession targeting the same ContainerItemInstanceId. I expected PlayFab to reject the 2nd call because the instance was already unlocked, but I found 2 copies of the container's item in my inventory.

Is it the client's job to defend against this? Am I misunderstanding how consumable-by-count works?

apis
3 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.

Seth Du avatar image Seth Du ♦ commented ·

I have tried few times to reproduce your issue but failed. the 2nd call returns the error message "Missing container item". Is your issue an incident? Does it always occur?

0 Likes 0 ·
warren avatar image warren Seth Du ♦ commented ·

I'm using title FA67, in case that matters. It's not an incident (is that bug report?). I'll try to come up with a minimum repro.

0 Likes 0 ·
warren avatar image warren Seth Du ♦ commented ·

I've been able to reproduce this in Unity:

List<PlayFab.ClientModels.ItemInstance> items;// assigned earlier

items.ForEach((x) =>
{
	for (int i = 0, ii = 5; i < ii; ++i)
	{
		if (x.ItemClass.Contains("Reward"))
		{
			PlayFab.PlayFabClientAPI.UnlockContainerInstance(new PlayFab.ClientModels.UnlockContainerInstanceRequest()
			{
				ContainerItemInstanceId = x.ItemInstanceId
			},
			(result) =>
			{
				Debug.LogFormat("<color=green>UnlockContainerInstance success: {0} {1}</color>", result.GrantedItems.Count, result.GrantedItems[0].ItemId);
			},
			(error) =>
			{
				Debug.LogFormat("<color=red>UnlockContainerInstance error:\n{0} {1}</color>", error.Error, error.ErrorMessage);
			});
		}
	}
});

I see in my logs that I got 5 callbacks from Playfab: 3 successes and 2x this error: "Service Unavailable HTTP/1.1 409 Conflict." However, my player inventory now shows 5 copies of the contained item. PlayStream shows 5 messages about the container's items being added to my inventory, and 1 message about the container being consumed.
0 Likes 0 ·

1 Answer

·
Seth Du avatar image
Seth Du answered

I have received the confirmation from our team. According to @Brendan, if two calls are received simultaneously, the issue you met may occur. We are aware of this issue and this year's up-coming new commerce system will fix this issue. Please keep track of the Roadmap updates on our website.

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.