supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

[Deno] ESM.sh module not found - index.d.ts (types)

Open 5hee75 opened this issue 2 years ago • 3 comments

Bug report

Describe the bug

Attempting to import @supabase/supabase-js type definitions through esm.sh, when included as a secondary package, fails with the following error:

Error: Module not found "https://esm.sh/v113/@supabase/[email protected]/dist/module/lib/types/dist/module/index.d.ts".

To Reproduce

This specific issue was found when trying to include the @supabase/auth-helpers-shared package via https://esm.sh/@supabase/[email protected] in a Deno project (Edge Functions).

The following repo should be able to reproduce the error.

https://github.com/astor-tech/supabase-edge-trpc

Note: Functionality seems ok when serving locally. The only issue is the type imports, so just the supabase functions deploy fails.

Steps to reproduce

  1. Fork and clone the repo above
  2. Link to a Supabase project
  3. Run supabase functions deploy
  4. Note deployment error listed above

Expected behavior

Type definitions should be available for the @supabase/supabase-js SDK through the esm.sh module for Deno.

https://esm.sh/v113/@supabase/[email protected]/dist/module/lib/types/dist/module/index.d.ts

Additional context

I was able to get the deployment to work functionally by using the auth helpers package from this CDN:

https://cdn.jsdelivr.net/npm/@supabase/auth-helpers-shared/+esm

However, that CDN doesn't seem to provide any useful type info, so using it with tRPC (my use case) becomes somewhat limiting.

(Split from https://github.com/supabase/supabase-js/issues/739)

5hee75 avatar Apr 07 '23 05:04 5hee75

@5hee75 Did you manage to resolve this? I have exactly the same problem with:

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

The edge function works just fine, but I am not able to build my next app because of this.

nalnir avatar Sep 28 '23 08:09 nalnir

@nalnir @5hee75 you can add supabase to the exclude section of tsconfig.json "exclude": ["node_modules", "supabase"],

gjohnsx avatar Nov 09 '23 21:11 gjohnsx

@5hee75 Did you manage to resolve this? I have exactly the same problem with:

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

The edge function works just fine, but I am not able to build my next app because of this.

Are you using docker? Since CLI 1.120.0, you do need to install docker as a prerequisite for deploying functions.

Lucas-AVS avatar Dec 17 '23 02:12 Lucas-AVS