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
937 stars 179 forks source link

Inconsistent Typescript types in CI when using tpes generation #2216

Open Panzki opened 1 month ago

Panzki commented 1 month ago

Describe the bug I want to verify my generated Typescript types in my CI as proposed here. However I'm facing the problem that the types generated in the CI environment differ from the ones generated locally.

To Reproduce Steps to reproduce the behavior:

  1. Run supabase gen types typescript --local > ./lib/database.types.ts locally and check in the result.
  2. Run supabase gen types typescript --local > ./lib/database.types.ts in CI.
  3. Use git to diff the file. This results in:
    diff --git a/packages/supabase/src/database.types.ts b/packages/supabase/src/database.types.ts
    index 8465ced..0de863f 100644
    --- a/packages/supabase/src/database.types.ts
    +++ b/packages/supabase/src/database.types.ts
    @@ -791,6 +791,10 @@ export type Database = {
         }
         Returns: boolean
       }
    +      install_extensions: {
    +        Args: Record<PropertyKey, never>
    +        Returns: undefined
    +      }
       is_account_owner: {
         Args: {
           account_id: string

Expected behavior No diff.

System information Rerun the failing command with --create-ticket flag.

Panzki commented 2 weeks ago

Hi @sweatybridge, is there any plan to try to fix this issue?

sweatybridge commented 2 weeks ago

Hi, I suspect the service version is different on CI. Could you try running supabase link on CI as well?

- run: supabase link --project-ref $SUPABASE_PROJECT_ID
- run: supabase gen types ...