cli: Auth.signUp Error in Local Env with Supabase CLI

Bug report

Describe the bug

supabase.auth.signup on local setup gives ‘Database error finding user’.

A clear and concise description of what the bug is.

Installed supabase cli, set up a local project, and then tried to do a simple user signup. On signup I get a status: 500 with message: Database error finding user.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. supabase init
  2. localhost:8000
  3. postgres port 5477 (only thing different from default)
  4. create index.js with the following:
import { createClient } from '@supabase/supabase-js'
const SUPABASE_URL = 'http://localhost:8000'
const SUPABASE_ANON_KEY = 'key-here'
const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY)

const main = async () => {
  const { user, session, error } = await supabase.auth.signUp({
    email: 'hi@gmail.com',
    password: 'superpasswordtighty',
  })
  console.log(user)       //null
  console.log(session)  //null
  console.log(error)     //{ message: 'Database error finding user', status: 500 }
}
main()

Expected behavior

A user would be created in the database. I can connect to postgres just fine, and it looks like everything is there (as far as I know). I also tried the auth.signIn method, and I get the same error (which makes sense since there’s no user yet). Not sure if the signUp method is getting it’s wires crossed with singIn?

Screenshots

postgres database: image

System information

  • OS: Windows running Ubuntu and Docker Desktop through WSL2

  • Version of supabase-js: 1.7.6, cli: 0.3.3

  • Version of Node.js: 15.6.0

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 28 (14 by maintainers)

Most upvoted comments

@kiwicopple this time just to make sure everything was clear I removed all containers and images.

@soedirgo a screen recording of the container logs. It does have ALTER ROLE

OS: Macos Big Sur - 11.2.1

Version of supabase-js: 1.7.6, cli: 0.3.4

Version of Node.js: Currently v14.16.0

https://user-images.githubusercontent.com/6943688/113379287-ef262d00-932d-11eb-99f0-f0ec2cd7180d.mov

Whew! Glad to have this resolved. 😄

@soedirgo that was it! I ended up having to run brew services stop postgresql Might be worth mention that in the documentation this edge case where local connections highjack the connection to the docker contiainer.

Thanks for your help!

Yes, I can sign in now, thanks for getting that sorted!!

Thanks for the follow up @KrisCoulson - let us investigate 👍

@soedirgo Looks like it’s here:

https://github.com/supabase/cli/blob/5666b4dad71da0d0d96de040952bfc4d0804a669/src/templates/init/docker/docker-compose.yml#L29

If the port is something other than 5432 I guess GoTrue can’t connect