Cannot access backend members data on accounts AFTER July 28

Hi wonderful Wix/EditorX/WixStudio developers!

I’ve been beating my head against the wall trying to figure out why ALL of my member accounts after 7/28/23 have been having issue adding content to my site, and I’ve realized that it’s an issue with accessing backend members data but only for member accounts created AFTER 7/28/23.

I built a custom members’ social feed that uses a lightbox to capture member inputs (post text + media), and then I use a backend beforeInsert dataHook to add in additional information to the item within my collection.

Here is the beforeInsert dataHook:
(NOTE: I’m adding screenshots because I’m having trouble figuring out how to add code in this new editor. How do we do that with this new forum?)

beforeInsert code in backend data.js
image

This works PERFECTLY on a ALL member accounts created before 7/28/23 including Admin, Collaborator, and Individual Member roles, BUT it does NOT WORK on any of these exact same account types with the exact same permissions and the exact same code if they were created after 7/28/23. Literally, the only difference between the accounts is creation date.

When I pull the member data for all accounts (both before and after 7/28) from the frontend, I am able to get Full Member data and all accounts are ‘status: APPROVED’ and ‘activity status: ACTIVE’. Again, the only difference in these accounts is the created date (same permissions, etc):

As for the code error, for all accounts on or before 7/28/23, no errors.
When I run the code for accounts after 7/28/23, I get the following error: [“Cannot read property ‘value’ of undefined”]

And the full error message from the log is:
image

image

The specific sourceLocation referenced is the backend memberData request. So, all of this to say, my site is returning backend memberData requests as undefined, BUT only for accounts created after 7/28/23. Weird.

Does anyone have ANY idea if:
(1) Something changed on the wix-members backend after 7/28/23
(2) Anything else I can possibly try to check what could be different between these accounts (all the registration, permisisons, and accounts statuses are the same)?

This is definitely a LOT and I’ll probably have to go directly to wix support, but ANY ideas or brainstorm options, would be GREATLY appreciated.

Thanks!

You have problem with this part of the code:

Check the custom fields of your members. The code is not able to see the value of your custom fields. Which becomes an error.

How can you fix this?

It’s not hard to fix. You can fix it by adding an if else statement to check if there is a custom field value if not just keep the code running and if yes pass the value to the item.

Empty custom fields are not returned probably one (or multiple) of the member you have doesn’t have a custom field value and it’s empty and that’s the reason why you are getting this error.

if (member.contactDetails.customFields["custom.location"]) {
   item.location = member.contactDetails.customFields["custom.location"].value;
}

Check the docs here.

Let me know if this works. (If it works please mark this as a solution :upside_down_face:)

1 Like

WOW!! Thank you SO MUCH! I’ll try this tomorrow and come back to mark as a solution. HONESTLY, I can’t possibly thank you enough for your response - it’s people like you who make this Forum my happy place :slight_smile:

Dang. I couldn’t wait for tomorrow (I know it’s Sunday evening, but I love it too much to put it down), so I went ahead and tried your suggestion.

I first started by commenting out the two custom fields to see if the rest of the code will run, and unfortunately, it still gave me the exact same error. I also added default blank strings for any unfilled fields.

Code screenshot:

I then tried a frontend import call of the exported backend ‘getMembersData’ (per the API documentation), and the code WILL give me a full members data object for accounts created on or before 7/28/23, but the same code returns the same [“Cannot read property ‘value’ of undefined”] error as before for accounts created after 7/28/23 .

It’s SO weird! It’s like the accounts created after that date were corrupted or something. The problem is… I didn’t change any of the registration parameters, AND using Wix’s own “Members/FullData” collection to check the account statuses, ALL of the accounts created on my site have the exact same statuses (and checking each count individually from my site dashboard shows that they have the exact same permissions). I honestly have NO idea why my accounts after a certain date will not return anything from backend members calls even though the accounts before that date work just fine.

For now, I’m going to try a wixData query of Members/FullData as a workaround for the info I need, BUT I’ll still keep tinkering with the backend membersData calls to try to figure out what’s going on. :woman_shrugging:

Would you like to give access to me so I can try to fix it and try to understand why this happens? If so let me know.

@loeiks THANKS SO MUCH! I’m contacting Wix support to see if they can determine if I have an issue with my members area since that’s where the issue seems to be. For now, I’ll use the data query workaround, and I’ll come back to update this when I find a solution.

1 Like