supabase / cli

Supabase CLI. Manage postgres migrations, run Supabase locally, deploy edge functions. Postgres backups. Generating types from your database schema.
https://supabase.com/docs/reference/cli/about
MIT License
1.07k stars 209 forks source link

Recreating database throws error on `provider_id` column for google oauth users #1801

Closed KajSzy closed 6 months ago

KajSzy commented 10 months ago

Describe the bug I've dumped my production data to sql file for local development purpose. Trying to reset local supabase instance I get an error that column type is invalid.

To Reproduce Steps to reproduce the behavior:

  1. Dump data from production (requires users signed up using google oauth) supabase db dump --data-only -f supabase/seed.sql
  2. Reset local supabase with new seed supabase db reset locally

Expected behavior As previous versions it was working fine, resetting local database should run smoothly for all signed up users.

Desktop (please complete the following information):

Additional context

Both databases show provider_id column as text

{
  "Type": "ErrorResponse",
  "Severity": "ERROR",
  "SeverityUnlocalized": "ERROR",
  "Code": "22P02",
  "Message": "invalid input syntax for type uuid: \"110207739924152032961\"",
  "Detail": "",
  "Hint": "",
  "Position": 1333,
  "InternalPosition": 0,
  "InternalQuery": "",
  "Where": "",
  "SchemaName": "",
  "TableName": "",
  "ColumnName": "",
  "DataTypeName": "",
  "ConstraintName": "",
  "File": "uuid.c",
  "Line": 133,
  "Routine": "string_to_uuid",
  "UnknownFields": null
}
sweatybridge commented 10 months ago

This is probably caused by mismatched versions between local and prod. You can sync up local gotrue version to match remote by running supabase link.

Let me know if db reset works after relinking.

KajSzy commented 10 months ago

Still throws same error, supabase link did not show any mismatches between local and remote

sweatybridge commented 10 months ago

In that case, could you create a ticket and report the crash id for me to take a closer look?

supabase db reset --create-ticket
KajSzy commented 10 months ago

In that case, could you create a ticket and report the crash id for me to take a closer look?

supabase db reset --create-ticket

Ticket id: 90f0cd39e8d84df289525bad7e767e7d

sweatybridge commented 10 months ago

Could you try db reset again after rm -rf supabase/.temp? The crash ticket looks ok to me.

KajSzy commented 10 months ago

Sadly, still same error. I'm quite sure it was working fine with older version but I am unable to test which one exactly. Tried beta but still got same error

EDIT: I've found out that with version 1.115.4 it works fine, but with 1.123.0 it starts to throw errors. I'm in the progress of fidning exact version at which it was broken

sweatybridge commented 6 months ago

This seems to be a duplicate of https://github.com/supabase/supabase/issues/19620#issuecomment-1856418658

The resolution is to update supabase/seed.sql according to the steps in the linked comment.