Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined confirmed_at on signup #22

Closed
hansy opened this issue Aug 28, 2020 · 1 comment · Fixed by #24
Closed

Undefined confirmed_at on signup #22

hansy opened this issue Aug 28, 2020 · 1 comment · Fixed by #24
Labels
bug Something isn't working

Comments

@hansy
Copy link

hansy commented Aug 28, 2020

Bug report

Describe the bug

When calling the signup method while email confirmations are enabled, an error is thrown: TypeError: Cannot read property 'confirmed_at' of undefined.

To Reproduce

First enable email confirmations in Supabase dashboard. Then:

const supabase = client.createClient(SUPABASE_URL, SUPABASE_API_KEY);
const createUser = async () => {
  try {
    const { body: { user } } = await supabase.auth.signup("[email protected]", "password");
    return user
  } catch (e) {
    return Promise.reject(e)
  }
};

createUser()
  .then(res => console.log(res))
  .catch(err => console.log(err))

Looks like the error is happening here:

if (response.status === 200 && response['body']['user']['confirmed_at']) {

The response returned doesn't include a user key in the body. I think the body is the user object itself.

Expected behavior

Signup should return response from POST request to /signup on auth url .

System information

  • OS: macOS
  • Version of supabase-js: 0.36.4
  • Version of Node.js: 14.5.0
@hansy hansy added the bug Something isn't working label Aug 28, 2020
@awalias
Copy link
Member

awalias commented Aug 29, 2020

good catch @hansy will get this patched asap

awalias added a commit that referenced this issue Aug 29, 2020
fix: #22 wont throw error for confirmation email signups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants