Why is currentMember.getMember() returning undefined?

Hi! I have a custom profile page in my website, and I want to display members’ info on it. One of my steps in doing that is getting the login email of the currently logged in member. I’m using the currentMember API and the getMember() method, and then logging the result to the console (this is for testing and to illustrate). However, after I log in and am redirected to the profile page, it says that the member is undefined. But after I reload the page, it gives the correct info. Why is this happening? I’m also getting this error:

And I’m wondering if it could have something to do with it. I was thinking that since the error says the URL was preloaded, it might have loaded before I logged in, and thus the current member would naturally be undefined. Here is the code I used to display the member to the console:

import { currentMember } from 'wix-members';
$w.onReady(function () {
    currentMember.getMember()
        .then((member) => {
            console.log(member);
        });
}

Any and all help is appreciated. Thanks in advance!!

And what if you also add onLogin to the page?
https://www.wix.com/velo/reference/wix-members/authentication-obj/onlogin
does it work?

Is that the code that you are using that says member is undefined ?

Is the user logged in? Who is the user? You? Anonymous visitor?

The page is members only, so the user should be logged in…

How would this help?

@solsticematholympiad Does this sound like the same issue you’re experiencing? https://www.wix.com/velo/forum/coding-with-velo/wixmember-not-working-after-initial-login-until-refresh

@marlowe-shaeffer Looks like it!

All what you should need to know about your issue…

@solsticematholympiad
The team is still working on fixing this issue. Thanks for your patience!

is this issue have been solved? I’m having the same issue

@marlowe-shaeffer ; Please provide an ETA for a correction. Thanks

Not yet. We aim to deploy the fix later this week, and we’ll update this thread as soon as it’s resolved. Thanks again for your patience.

https://www.wix.com/velo/forum/coding-with-velo/persistant-wix-authentication-wix-members-api-issue

@marlowe-shaeffer did it get fixed? I’m still getting an undefined response