Skip to content

Type Generation: Differences between Local and Remote Types #3230

Open
@phillipmohr

Description

@phillipmohr

Describe the bug
My type check in CI is failing.

These are the differences

Detected uncommitted changes after build. See status below:
diff --git a/types/supabase-generated.types.ts b/types/supabase-generated.types.ts
index 6ba5c92..3173a7a 100644
--- a/types/supabase-generated.types.ts
+++ b/types/supabase-generated.types.ts
@@ -1138,6 +1138,7 @@ export type Database = {
           created_at: string | null
           id: string
           last_accessed_at: string | null
+          level: number | null
           metadata: Json | null
           name: string | null
           owner: string | null
@@ -1152,6 +1153,7 @@ export type Database = {
           created_at?: string | null
           id?: string
           last_accessed_at?: string | null
+          level?: number | null
           metadata?: Json | null
           name?: string | null
           owner?: string | null
@@ -11[66](https://github.com/Stride-Agency/leadpros-saas/actions/runs/13539959975/job/37840259224#step:7:67),6 +1168,7 @@ export type Database = {
           created_at?: string | null
           id?: string
           last_accessed_at?: string | null
+          level?: number | null
           metadata?: Json | null
           name?: string | null
           owner?: string | null
@@ -1185,6 +1188,38 @@ export type Database = {
           },
         ]
       }
+      prefixes: {
+        Row: {
+          bucket_id: string
+          created_at: string | null
+          level: number
+          name: string
+          updated_at: string | null
+        }
+        Insert: {
+          bucket_id: string
+          created_at?: string | null
+          level?: number
+          name: string
+          updated_at?: string | null
+        }
+        Update: {
+          bucket_id?: string
+          created_at?: string | null
+          level?: number
+          name?: string
+          updated_at?: string | null
+        }
+        Relationships: [
+          {
+            foreignKeyName: "prefixes_bucketId_fkey"
+            columns: ["bucket_id"]
+            isOneToOne: false
+            referencedRelation: "buckets"
+            referencedColumns: ["id"]
+          },
+        ]
+      }
       s3_multipart_uploads: {
         Row: {
           bucket_id: string
@@ -1288,6 +1323,13 @@ export type Database = {
       [_ in never]: never
     }
     Functions: {
+      add_prefixes: {
+        Args: {
+          _bucket_id: string
+          _name: string
+        }
+        Returns: undefined
+      }
       can_insert_object: {
         Args: {
           bucketid: string
@@ -1297,6 +1339,13 @@ export type Database = {
         }
         Returns: undefined
       }
+      delete_prefix: {
+        Args: {
+          _bucket_id: string
+          _name: string
+        }
+        Returns: boolean
+      }
       extension: {
         Args: {
           name: string
@@ -1315,6 +1364,24 @@ export type Database = {
         }
         Returns: string[]
       }
+      get_level: {
+        Args: {
+          name: string
+        }
+        Returns: number
+      }
+      get_prefix: {
+        Args: {
+          name: string
+        }
+        Returns: string
+      }
+      get_prefixes: {
+        Args: {
+          name: string
+        }
+        Returns: string[]
+      }
       get_size_by_bucket: {
         Args: Record<PropertyKey, never>
         Returns: {
@@ -13[77](https://github.com/Stride-Agency/leadpros-saas/actions/runs/13539959975/job/37840259224#step:7:78),6 +1444,63 @@ export type Database = {
           metadata: Json
         }[]
       }
+      search_legacy_v1: {
+        Args: {
+          prefix: string
+          bucketname: string
+          limits?: number
+          levels?: number
+          offsets?: number
+          search?: string
+          sortcolumn?: string
+          sortorder?: string
+        }
+        Returns: {
+          name: string
+          id: string
+          updated_at: string
+          created_at: string
+          last_accessed_at: string
+          metadata: Json
+        }[]
+      }
+      search_v1_optimised: {
+        Args: {
+          prefix: string
+          bucketname: string
+          limits?: number
+          levels?: number
+          offsets?: number
+          search?: string
+          sortcolumn?: string
+          sortorder?: string
+        }
+        Returns: {
+          name: string
+          id: string
+          updated_at: string
+          created_at: string
+          last_accessed_at: string
+          metadata: Json
+        }[]
+      }
+      search_v2: {
+        Args: {
+          prefix: string
+          bucket_name: string
+          limits?: number
+          levels?: number
+          start_after?: string
+        }
+        Returns: {
+          key: string
+          name: string
+          id: string
+          updated_at: string
+          created_at: string
+          metadata: Json
+        }[]
+      }

A similar problem has happened to me before and it was due to an oudated local Supabase CLI. But my Supabase CLI is up to date. Even ran this command to ensure it's using the latest version to generate the types:
pnpm dlx supabase@latest gen types typescript --local > types/supabase-generated.types.ts

But still, no luck. It doesn't generate an updated types file.

I also compared my local + linked versions and everything is the same:
Result of supabase services

    SERVICE IMAGE      │      LOCAL       │  LINKED
supabase/postgres      │ 15.1.1.61        │ 15.1.1.61
supabase/gotrue        │ v2.168.0         │ v2.168.0
postgrest/postgrest    │ v12.1            │ v12.1
supabase/realtime      │ v2.34.31         │ -
supabase/storage-api   │ v1.17.1          │ v1.17.1
supabase/edge-runtime  │ v1.67.2          │ -
supabase/studio        │ 20250224-d10db0f │ -
supabase/postgres-meta │ v0.86.0          │ -
supabase/logflare      │ 1.11.0           │ -
supabase/supavisor     │ 2.3.9            │ -

Here is part of my ci.yaml

db-schema-check:
    name: Database schemas check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Cache Docker images.
        uses: ScribeMD/docker-cache@0.3.6
        with:
          key: docker-${{ runner.os }}-${{ hashFiles('supabase/config.toml') }}

      - uses: supabase/setup-cli@v1
        with:
          version: latest

      - run: supabase db start
      - run: supabase db lint

      # This is failing
      - name: Verify generated types are checked in
        run: |
          supabase gen types typescript --local > ./types/supabase-generated.types.ts
          if ! git diff --ignore-space-at-eol --exit-code --quiet ./types/supabase-generated.types.ts; then
            echo "Detected uncommitted changes after build. See status below:"
            git diff
            exit 1
          fi

To Reproduce

  • Run supabase gen types typescript --local > types/supabase-generated.d.ts locally
  • Use github action provided above

Expected behavior

No diff.

Desktop (please complete the following information):
Supabase version: 2.15.8
OS: Mac OS
Version of Node.js: v18.14.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions