User.update .then function is undefined

When I call this code here

I get this error:

Code is here:

https://github.com/QuantumInformation/svelte-fullstack-starter/blob/master/src/stores/netlifyUserStore.js#L38

this is a showstopper for me

Reposted and created a tag on SO https://stackoverflow.com/questions/59246538/issue-with-netlify-gotrue-user-update-method

@QuantumJS have you verified that you have a valid logged in user at the time that you are calling the update function?

Yes I confirm, I tried it on another project, same error

You mentioned that the user variable is definitely not undefined. Could you console.log the user var before you call update() and .then() chain? Do you get the user object? That’ll help narrow down why user is undefined.

That said, I see you’ve refactored to async/await functions. Did that help resolve your issue?

I’ve updated the github issue, my refactors fixed stuff. my mistake

this can be closed.

1 Like

the updated issue is now that the users email can’t be changed with the update function:

So are we to assume the user can never change their primary email? Seems very limiting for an auth system.

Thanks for filing that issue @QuantumJS, I agree that users should be able to update their own e-mails from the client rather than requiring an admin to do it. Note that as a current workaround you can do that update inside of a netlify function using the admin token passed in to there.

1 Like