Error: undefined is not an object (evaluating 'i.status') when registering a New User

So I’m trying to register a user manually using velo. I followed the documentation pretty closely but I still get this error:

Error: undefined is not an object (evaluating ‘i.status’)

I even tried this with the newer version of authentication since this one is deprecated, but I still get the same error. It’s so bizarre.

Thank you so much for the help

You most likely used the Preview function when you tested your custom registration.

As noted in the documentation for wixUsers.register():

  • The APIs in wix-users are only partially functional when previewing your site. View a published version of your site to see their complete functionality.

Using the following code:

import wixUsers from 'wix-users';

$w.onReady(function () {
    $w('#register').onClick( () => {
        const username = $w('#username').value;
        const password = $w('#password').value;
        const email = username + '@email.com';

        wixUsers.register(email,password)
            .then(result => {
                console.log(result);
            });
    });
});

In Preview Mode it throws an error:

Meanwhile on the Published Site you can see that registration works and returns a object indicating the new user has been registered.

In terms of the code you provided I recommend:

  • Using the new Wix-Members registration function as Wix Users is now deprecated

  • Not converting the email parameter in the registration function into a username. This can introduce issues if a user enters a email as ‘testuser@email.com’ would try to register the user ‘testuser@email.com@email.com’

Instead, check out this robust custom registration example using the new Wix Members API.