supabaseedge-function

Supabase edge functions deno - Cannot find module in next js


I'm using Next 13.4 and typescript. I have a supabase edge function where I import from 2 different modules:

import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
import { createClient } from 'https://esm.sh/@supabase/supabase-js@2?target=deno&no-check';

The function works well, but these import don't allow me to build my app and deploy it giving these errors which are technically the same:

Cannot find module 'https://deno.land/std@0.168.0/http/server.ts' or its corresponding type declarations.
Cannot find module 'https://esm.sh/@supabase/supabase-js@2?target=deno&no-check' or its corresponding type declarations.

I've seen the same issue here: https://github.com/supabase/supabase-js/issues/744

But no answer to it.


Solution

  • You can add supabase to the exclude section of tsconfig.json

    "exclude": ["node_modules", "supabase"],