SupabaseS
Supabase4y ago
pid1

Importing createClient into edge function throws TS error and cannot start

I posted images of the code and errors. I removed all the code in my actual function to show it's the import statement failing.

Function code:
// Follow this setup guide to integrate the Deno language server with your editor:
// https://deno.land/manual/getting_started/setup_your_environment
// This enables autocomplete, go to definition, etc.

import { serve } from 'https://deno.land/std@0.131.0/http/server.ts';
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.0.0';


Error:
Download https://deno.land/std@0.165.0/node/internal_binding/_winerror.ts
Check file:///home/deno/functions/test/index.ts
error: TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s).
    at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:57:126

TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s).
    from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<View>;
                                                                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:58:120

TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s).
    from(relation: string): PostgrestQueryBuilder<any>;
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:59:29

TS2314 [ERROR]: Generic type 'PostgrestFilterBuilder<Schema, Row, Result>' requires 3 type argument(s).
    at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:72:9

Found 4 errors.
2022/11/21 11:28:48 Sent Header: Host [docker]
2022/11/21 11:28:48 Sent Header: User-Agent [Go-http-client/1.1]
2022/11/21 11:28:48 Send Done
2022/11/21 11:28:48 Recv First Byte
Error: error executing command


Execution: supabase functions serve test --debug

Thank you for any help you can offer!
image.png
image.png
Was this page helpful?