question

Bryan Matsui Pierce avatar image
Bryan Matsui Pierce asked

Error with UpdateDraftItem

I am trying to update the ItemReferences of a bundle in my catalog and I am getting an error that I cannot recognize.

In the request, I am pretty much updating the ItemReferences and StartDate variables. Everything else is staying the same.

Here is my code:

UpdateDraftItemRequest updateDraftItemRequest = new UpdateDraftItemRequest() {
    Item = new CatalogItem() {
        CreatorEntity = bundle.CreatorEntity,
        Type = bundle.Type,
        Id = bundle.Id,
        ItemReferences = new List<CatalogItemReference>() {
            new CatalogItemReference() {
                Id = newPassItemId,
                Amount = 1
            }
        },
        ContentType = bundle.ContentType,
        Title = bundle.Title,
        AlternateIds = bundle.AlternateIds,
        DisplayProperties = bundle.DisplayProperties,
        Tags = bundle.Tags,
        StartDate = DateTime.Now,
    },
    Publish = true
};
PlayFabResult<UpdateDraftItemResponse> updateDraftItemResult = (await PlayFabEconomyAPI.UpdateDraftItemAsync(updateDraftItemRequest));
if (updateDraftItemResult.Error != null) Log.Error(updateDraftItemResult.Error.GenerateErrorReport());

The weird thing about the error is that it occurs like 9/10 times. There are cases where the UpdateDraftItem does go through. Here is the error that is posted by GenerateErrorReport:

[Error] OK1-637d2e4a-0fdde359247219f35f4b8fe1MS-CV: yzQTve7IfkS6hVBgHOUg4A.0

Is there something that I am missing for this?

In-Game Economy
10 |1200

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

kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

It looks like the error you're getting in the logs is "Item cannot be published as not all the ItemReferences exist in the Published catalog". You should double-check the state of all the items you're referencing.

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.

Bryan Matsui Pierce avatar image Bryan Matsui Pierce commented ·

I guess this makes sense. I am calling UpdateDraftItem right after I create a new item. This explains why the function works occasionally. I guess the solution is to wait 1 second before calling UpdateDraftItem

0 Likes 0 ·
Bryan Matsui Pierce avatar image
Bryan Matsui Pierce answered

Just in case: my TitleID is 35765

10 |1200

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

Bryan Matsui Pierce avatar image
Bryan Matsui Pierce answered

Update: I can't say for sure but the error occurs when I call them within like 10 mins of each other. If I wait for more than that then the error doesn't occur

10 |1200

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

Bryan Matsui Pierce avatar image
Bryan Matsui Pierce answered

I guess this makes sense. I am calling UpdateDraftItem right after I create a new item. This explains why the function works occasionally. I guess the solution is to wait 1 second before calling UpdateDraftItem

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.