question

Adam El-Khayyat avatar image
Adam El-Khayyat asked

409 Conflict on UpdateUserData

Hi,

When a user registers to my title I use AddUsernamePassword and afterwards fill in the needed details of the player using the following methods:
-UpdateUserData (public permission)

-UpdateUserData (private permission)

-UpdateUserTitleDisplayName

I seem to consistently get an error in the first two UpdateUserData methods. I tried with only one of the UpdateUserData (public permissions one) and testing it with only running one of the two but I still, somehow, get the conflict error.

Any advice on how to structure these functions in order to avoid the conflict and why would the error happen in the first place (in the case where I only called UpdateUserData (public permission))?

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

Adam El-Khayyat avatar image Adam El-Khayyat commented ·

This is the error I got, btw.

{ code: 409,

  status: 'Conflict',

  error: 'A conflict occurred trying to make multiple edits to the same data at the same time. This often indicates that there are multiple concurrent requests to the same API for the same player',

  errorCode: 1133,

  errorMessage: 'A conflict occurred trying to make multiple edits to the same data at the same time. This often indicates that there are multiple concurrent requests to the same API for the same player',

  errorHash: '7231a7255ba5efd5c861b252c73c8a74',

  errorDetails: { RequestID: [ '1-5cd18938-fea9a0af622a839d6c0414c8' ] } }

I understand the error message is clearly stating the issue but I don't necessarily see how I might be doing concurrent requests to the api API for the same player on the same data.

0 Likes 0 ·
jital avatar image jital ♦ Adam El-Khayyat commented ·

Hello,

Can you post the code that you're using? What SDK you're using? And your TitleID?

0 Likes 0 ·
Adam El-Khayyat avatar image Adam El-Khayyat jital ♦ commented ·

Hey jital,

Thank you for your time.

I'm using the client SDK and my titleID is EDD7.

Here's the code I'm using...

public registerEmail = (req: Request, res: Response) => {
    PlayFabClient.AddUsernamePassword({
        Email: req.body.email,
        Password: req.body.password,
        Username: req.body.username
    }, (error, result) => {
        if (result !== null) {

            addAccountContactEmail(req.body.email);

            addAccountDetails({
                data: {
                    DOB:req.body.dob,
                    firstName: req.body.firstName,
                    lastName: req.body.lastName,
                    gender: req.body.gender,
                    country: req.body.country
                }
            });

            updateUserDisplayName(req.body.username);

            res.redirect("/dashboard");
        } else if (error !== null) {
            ...
        }
    });
};
0 Likes 0 ·
Show more comments
jital avatar image jital ♦ commented ·

In the code you posted there is a UpdateuserData call to add the contact email. Is there a specific reason you need to do this instead of using the AddOrUpdateContactEmail API call?

0 Likes 0 ·
Adam El-Khayyat avatar image Adam El-Khayyat jital ♦ commented ·

Initially it due to me not having to use the contact email for anything, so my thinking process behind it was to add it into the user data for the player for the time being in order to easily retrieve it when showing a user's profile.

But I probably need to revisit that and use the proper API call because I need to start using the contact email soon anyways.

Edit: completed went over my head, but here is the reason as to why I did it...

https://community.playfab.com/questions/25631/allow-client-access-to-contact-email-for-own-profi.html

As the answer suggests:

Yes, it is impossible to expose contact email addresses to only the owners with setting Client Profile Options. As you've known this setting is globally as it's at the title level. I'd suggest you disable Contact email addresses in the setting and set the addresses in Player Data with Permissions set to "Private". So that only the player himself can get contact email addresses.
0 Likes 0 ·

1 Answer

·
jital avatar image
jital answered

Hello,

After looking into this issue further, I have found that the best practices for making API calls that act on the same data is to wait for the successful callback and then make any additional calls. What you can do is make your additional call to UpdateUserData in the successful callback of your first call.

The reason why you received the error when only making one call is because there may have been an unusual load condition preventing the call from being successful. More information can be found in this forum post

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.

Adam El-Khayyat avatar image Adam El-Khayyat commented ·

Hi jital,

Thanks for the answer, I will give that a go and let you know if that fixes my issue.

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.