Cannot read property 'member' of null When creating Wix User

Hey Team,

I have a custom user input form that is doing a number of things on the back end integrating with stripe along with creating wix users and inserting some data into a data set. I am stuck at the point at which the code registers a wix user and then tries to insert data into a wix data set. It is very odd because the wix user is generated in the wix dashboard, but the code stops at the catch error and returns and error of "Cannot read property ‘member’ of null. I have have used the debugger at that point in the code to check that all fields are populated that are being passed and none of them are null. Has anyone run into this issue before? Is there something I am missing?

Below is my code. Seems to match with the corvid API documentation.

async function signUpMember(response, cus, lastFour, brand, subStatus) {
console.log("signing up wix member"); //show when member sign up starts
let array = [];
let phone = $w("#phone").value;
await array.push(phone);
wixUsers.register($w("#email").value, $w("#password").value, {
"contactInfo": {
"firstName": $w("#fName").value,
"lastName": $w("#lName").value,
"phones": array,
"country": $w("#country").value
}
})
.then((result) => {
console.log("signing up wix memeber"); //show when member sign up starts
confirmInsertSuccess(response, cus, lastFour, brand, subStatus);

})
.catch((err) => {console.log(`could not insert into paying members: ${err}`); //show when member sign up starts
debugger
});
}

It does seem that a user ran into a similar issue on this post which is now closed. https://www.wix.com/corvid/forum/community-discussion/solved-console-js-35-cannot-read-property-member-of-null

I am facing the exact same problem.
Have you managed to understand what’s causing this error?

I am also having the exact problem! my error is reading ’ null is not an object (evaluating ‘e.member’)’ the context is the exact same.

Hi guys, turns out there is not a problem with the code. It is just that sometimes Wix members register doesn’t sometimes test and you have to do in live mode. Worked a charm and now working for me! try testing it in live mode. Hope that helps you guys too!