Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: Use npm specifier instead of jsr for supabase-js imports (#36291)

Lakshan Perera3c390c7891ef
diff --git a/apps/docs/content/guides/ai/examples/huggingface-image-captioning.mdx b/apps/docs/content/guides/ai/examples/huggingface-image-captioning.mdx
index d2737bd6e29..90a34c421f3 100644
--- a/apps/docs/content/guides/ai/examples/huggingface-image-captioning.mdx
+++ b/apps/docs/content/guides/ai/examples/huggingface-image-captioning.mdx
@@ -41,7 +41,7 @@ Find the complete code on [GitHub](https://github.com/supabase/supabase/tree/mas
```ts
import { serve } from 'https://deno.land/[email protected]/http/server.ts'
import { HfInference } from 'https://esm.sh/@huggingface/[email protected]'
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:@supabase/supabase-js@2'
import { Database } from './types.ts'
console.log('Hello from `huggingface-image-captioning` function!')
diff --git a/apps/docs/content/guides/ai/hybrid-search.mdx b/apps/docs/content/guides/ai/hybrid-search.mdx
index d0273dea535..8c53309df9d 100644
--- a/apps/docs/content/guides/ai/hybrid-search.mdx
+++ b/apps/docs/content/guides/ai/hybrid-search.mdx
@@ -166,7 +166,7 @@ from
In practice, you will likely be calling this from the [Supabase client](/docs/reference/javascript/introduction) or through a custom backend layer. Here is a quick example of how you might call this from an [Edge Function](/docs/guides/functions) using JavaScript:
```tsx
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:@supabase/supabase-js@2'
import OpenAI from 'npm:openai'
const supabaseUrl = Deno.env.get('SUPABASE_URL')!
diff --git a/apps/docs/content/guides/functions/auth.mdx b/apps/docs/content/guides/functions/auth.mdx
index 17ef8d77112..34ec98d4e36 100644
--- a/apps/docs/content/guides/functions/auth.mdx
+++ b/apps/docs/content/guides/functions/auth.mdx
@@ -12,7 +12,7 @@ Edge Functions work seamlessly with [Supabase Auth](/docs/guides/auth).
When a user makes a request to an Edge Function, you can use the Authorization header to set the Auth context in the Supabase client:
```js
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:@supabase/supabase-js@2'
Deno.serve(async (req: Request) => {
@@ -41,7 +41,7 @@ Importantly, this is done _inside_ the `Deno.serve()` callback argument, so that
After initializing a Supabase client with the Auth context, you can use `getUser()` to fetch the user object, and run queries in the context of the user with [Row Level Security (RLS)](/docs/guides/database/postgres/row-level-security) policies enforced.
```js
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:@supabase/supabase-js@2'
Deno.serve(async (req: Request) => {
@@ -74,7 +74,7 @@ Deno.serve(async (req: Request) => {
After initializing a Supabase client with the Auth context, all queries will be executed with the context of the user. For database queries, this means [Row Level Security](/docs/guides/database/postgres/row-level-security) will be enforced.
```js
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:@supabase/supabase-js@2'
Deno.serve(async (req: Request) => {
diff --git a/apps/docs/content/guides/functions/connect-to-postgres.mdx b/apps/docs/content/guides/functions/connect-to-postgres.mdx
index 22b0ada259b..4dda5fef52f 100644
--- a/apps/docs/content/guides/functions/connect-to-postgres.mdx
+++ b/apps/docs/content/guides/functions/connect-to-postgres.mdx
@@ -14,7 +14,7 @@ You can also use other Postgres clients like [Deno Postgres](https://deno.land/x
The `supabase-js` client is a great option for connecting to your Supabase database since it handles authorization with Row Level Security, and it automatically formats your response as JSON.
```ts index.ts
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:@supabase/supabase-js@2'
Deno.serve(async (req) => {
try {
diff --git a/apps/docs/content/guides/functions/examples/elevenlabs-generate-speech-stream.mdx b/apps/docs/content/guides/functions/examples/elevenlabs-generate-speech-stream.mdx
index c02ae3827e3..b54da3e98ce 100644
--- a/apps/docs/content/guides/functions/examples/elevenlabs-generate-speech-stream.mdx
+++ b/apps/docs/content/guides/functions/examples/elevenlabs-generate-speech-stream.mdx
@@ -98,7 +98,7 @@ In your newly created `supabase/functions/text-to-speech/index.ts` file, add the
```ts supabase/functions/text-to-speech/index.ts
// Setup type definitions for built-in Supabase Runtime APIs
import 'jsr:@supabase/functions-js/edge-runtime.d.ts'
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:@supabase/supabase-js@2'
import { ElevenLabsClient } from 'npm:[email protected]'
import * as hash from 'npm:object-hash'
diff --git a/apps/docs/content/guides/functions/examples/elevenlabs-transcribe-speech.mdx b/apps/docs/content/guides/functions/examples/elevenlabs-transcribe-speech.mdx
index d5c9a506b27..32ee3cf091c 100644
--- a/apps/docs/content/guides/functions/examples/elevenlabs-transcribe-speech.mdx
+++ b/apps/docs/content/guides/functions/examples/elevenlabs-transcribe-speech.mdx
@@ -108,7 +108,7 @@ In your newly created `scribe-bot/index.ts` file, add the following code:
```ts supabase/functions/scribe-bot/index.ts
import { Bot, webhookCallback } from 'https://deno.land/x/[email protected]/mod.ts'
import 'jsr:@supabase/functions-js/edge-runtime.d.ts'
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:@supabase/supabase-js@2'
import { ElevenLabsClient } from 'npm:[email protected]'
console.log(`Function "elevenlabs-scribe-bot" up and running!`)
diff --git a/apps/docs/content/guides/functions/examples/push-notifications.mdx b/apps/docs/content/guides/functions/examples/push-notifications.mdx
index 846beb6b9e8..6a50add4ea8 100644
--- a/apps/docs/content/guides/functions/examples/push-notifications.mdx
+++ b/apps/docs/content/guides/functions/examples/push-notifications.mdx
@@ -53,7 +53,7 @@ Push notifications are an important part of any mobile app. They allow you to se
1. `supabase secrets set --env-file .env.local`
```ts supabase/functions/push/index.ts
- import { createClient } from 'jsr:@supabase/supabase-js@2'
+ import { createClient } from 'npm:@supabase/supabase-js@2'
console.log('Hello from Functions!')
diff --git a/apps/docs/content/guides/functions/unit-test.mdx b/apps/docs/content/guides/functions/unit-test.mdx
index 058c4a3275f..523129d33d7 100644
--- a/apps/docs/content/guides/functions/unit-test.mdx
+++ b/apps/docs/content/guides/functions/unit-test.mdx
@@ -35,7 +35,7 @@ The following script is a good example to get started with testing your Edge Fun
```typescript function-one-test.ts
// Import required libraries and modules
import { assert, assertEquals } from 'jsr:@std/assert@1'
-import { createClient, SupabaseClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient, SupabaseClient } from 'npm:@supabase/supabase-js@2'
// Will load the .env file to Deno.env
import 'jsr:@std/dotenv/load'
diff --git a/apps/docs/content/guides/functions/websockets.mdx b/apps/docs/content/guides/functions/websockets.mdx
index 1a4762e1d22..14aaa6c116b 100644
--- a/apps/docs/content/guides/functions/websockets.mdx
+++ b/apps/docs/content/guides/functions/websockets.mdx
@@ -123,7 +123,7 @@ To authenticate the user making WebSocket requests, you can pass the JWT in URL
>
<TabPanel id="query" label="Using query params">
```ts
- import { createClient } from "jsr:@supabase/supabase-js@2";
+ import { createClient } from "npm:@supabase/supabase-js@2";
const supabase = createClient(
Deno.env.get("SUPABASE_URL"),
@@ -173,7 +173,7 @@ return new Response("User is not authenticated", { status: 403 });
</TabPanel>
<TabPanel id="protocol" label="Using custom protocol">
```ts
- import { createClient } from "jsr:@supabase/supabase-js@2";
+ import { createClient } from "npm:@supabase/supabase-js@2";
const supabase = createClient(
Deno.env.get("SUPABASE_URL"),
diff --git a/apps/docs/content/guides/telemetry/log-drains.mdx b/apps/docs/content/guides/telemetry/log-drains.mdx
index 746fff13e0f..14c2d2d8282 100644
--- a/apps/docs/content/guides/telemetry/log-drains.mdx
+++ b/apps/docs/content/guides/telemetry/log-drains.mdx
@@ -51,7 +51,7 @@ supabase functions new hello-world
You can use this example snippet as an illustration of how the received request will be like.
```ts
-import 'jsr:@supabase/functions-js/edge-runtime.d.ts'
+import 'npm:@supabase/functions-js/edge-runtime.d.ts'
Deno.serve(async (req) => {
const data = await req.json()
diff --git a/apps/docs/docs/ref/javascript/installing.mdx b/apps/docs/docs/ref/javascript/installing.mdx
index 3a5d4cbe44d..58e1b6555e2 100644
--- a/apps/docs/docs/ref/javascript/installing.mdx
+++ b/apps/docs/docs/ref/javascript/installing.mdx
@@ -80,7 +80,7 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
<RefSubLayout.Examples>
```ts
- import { createClient } from 'jsr:@supabase/supabase-js@2'
+ import { createClient } from 'npm:@supabase/supabase-js@2'
```
</RefSubLayout.Examples>
diff --git a/examples/edge-functions/supabase/functions/background-upload-storage/index.ts b/examples/edge-functions/supabase/functions/background-upload-storage/index.ts
index 6ab56876341..77b88f94ba0 100644
--- a/examples/edge-functions/supabase/functions/background-upload-storage/index.ts
+++ b/examples/edge-functions/supabase/functions/background-upload-storage/index.ts
@@ -1,4 +1,4 @@
-import { createClient } from 'jsr:@supabase/[email protected]'
+import { createClient } from 'npm:supabase-js@2'
import OpenAI from 'https://deno.land/x/[email protected]/mod.ts'
const client = new OpenAI({ apiKey: Deno.env.get('OPENAI_API_KEY')! })
diff --git a/examples/edge-functions/supabase/functions/elevenlabs-speech-to-text/index.ts b/examples/edge-functions/supabase/functions/elevenlabs-speech-to-text/index.ts
index 67dbc523292..df3c0531d73 100644
--- a/examples/edge-functions/supabase/functions/elevenlabs-speech-to-text/index.ts
+++ b/examples/edge-functions/supabase/functions/elevenlabs-speech-to-text/index.ts
@@ -4,7 +4,7 @@
// Setup type definitions for built-in Supabase Runtime APIs
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
-import { createClient } from "jsr:@supabase/supabase-js@2";
+import { createClient } from "npm:supabase-js@2";
console.log(`Function "elevenlabs-scribe-bot" up and running!`);
diff --git a/examples/edge-functions/supabase/functions/elevenlabs-text-to-speech/index.ts b/examples/edge-functions/supabase/functions/elevenlabs-text-to-speech/index.ts
index 3b1332632b5..b55d8f455e3 100644
--- a/examples/edge-functions/supabase/functions/elevenlabs-text-to-speech/index.ts
+++ b/examples/edge-functions/supabase/functions/elevenlabs-text-to-speech/index.ts
@@ -1,6 +1,6 @@
// Setup type definitions for built-in Supabase Runtime APIs
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
-import { createClient } from "jsr:@supabase/supabase-js@2";
+import { createClient } from "npm:supabase-js@2";
import { ElevenLabsClient } from "npm:[email protected]";
import * as hash from "npm:object-hash";
diff --git a/examples/edge-functions/supabase/functions/file-upload-storage/index.ts b/examples/edge-functions/supabase/functions/file-upload-storage/index.ts
index e90e5ae71c2..954bcc05efb 100644
--- a/examples/edge-functions/supabase/functions/file-upload-storage/index.ts
+++ b/examples/edge-functions/supabase/functions/file-upload-storage/index.ts
@@ -2,7 +2,7 @@
// and write files to Supabase Storage and other fields to a database table.
import { Application } from 'https://deno.land/x/[email protected]/mod.ts'
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:supabase-js@2'
const MB = 1024 * 1024
diff --git a/examples/edge-functions/supabase/functions/get-tshirt-competition/index.ts b/examples/edge-functions/supabase/functions/get-tshirt-competition/index.ts
index 16a89ab145c..5d94fe3404f 100644
--- a/examples/edge-functions/supabase/functions/get-tshirt-competition/index.ts
+++ b/examples/edge-functions/supabase/functions/get-tshirt-competition/index.ts
@@ -2,7 +2,7 @@
// https://deno.land/manual/getting_started/setup_your_environment
// This enables autocomplete, go to definition, etc.
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:supabase-js@2'
import { corsHeaders } from '../_shared/cors.ts'
console.log(`Function "get-tshirt-competition" up and running!`)
diff --git a/examples/edge-functions/supabase/functions/huggingface-image-captioning/index.ts b/examples/edge-functions/supabase/functions/huggingface-image-captioning/index.ts
index 4e5a7e909e3..646fc2070f6 100644
--- a/examples/edge-functions/supabase/functions/huggingface-image-captioning/index.ts
+++ b/examples/edge-functions/supabase/functions/huggingface-image-captioning/index.ts
@@ -1,5 +1,5 @@
import { HfInference } from 'https://esm.sh/@huggingface/[email protected]'
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:supabase-js@2'
import { Database } from './types.ts'
console.log('Hello from `huggingface-image-captioning` function!')
diff --git a/examples/edge-functions/supabase/functions/openai-image-generation/index.ts b/examples/edge-functions/supabase/functions/openai-image-generation/index.ts
index 3f6dd06061b..f9aa4e975c8 100644
--- a/examples/edge-functions/supabase/functions/openai-image-generation/index.ts
+++ b/examples/edge-functions/supabase/functions/openai-image-generation/index.ts
@@ -2,7 +2,7 @@
// - `generated-images` bucket already created.
// - `OPENAI_API_KEY` environment variable set.
-import { createClient } from "npm:@supabase/[email protected]";
+import { createClient } from "npm:supabase-js@2";
import OpenAI, { toFile } from "jsr:@openai/[email protected]";
// Configure COS headers for the function
diff --git a/examples/edge-functions/supabase/functions/read-storage/index.ts b/examples/edge-functions/supabase/functions/read-storage/index.ts
index 938b435b173..db5ea0a3488 100644
--- a/examples/edge-functions/supabase/functions/read-storage/index.ts
+++ b/examples/edge-functions/supabase/functions/read-storage/index.ts
@@ -2,7 +2,7 @@
// https://deno.land/manual/getting_started/setup_your_environment
// This enables autocomplete, go to definition, etc.
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:supabase-js@2'
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
diff --git a/examples/edge-functions/supabase/functions/restful-tasks/index.ts b/examples/edge-functions/supabase/functions/restful-tasks/index.ts
index 4b40c117c5d..3b6084f2d69 100644
--- a/examples/edge-functions/supabase/functions/restful-tasks/index.ts
+++ b/examples/edge-functions/supabase/functions/restful-tasks/index.ts
@@ -2,7 +2,7 @@
// https://deno.land/manual/getting_started/setup_your_environment
// This enables autocomplete, go to definition, etc.
-import { createClient, SupabaseClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient, SupabaseClient } from 'npm:supabase-js@2'
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
diff --git a/examples/edge-functions/supabase/functions/select-from-table-with-auth-rls/index.ts b/examples/edge-functions/supabase/functions/select-from-table-with-auth-rls/index.ts
index 04fa80dd0b2..c344baafe63 100644
--- a/examples/edge-functions/supabase/functions/select-from-table-with-auth-rls/index.ts
+++ b/examples/edge-functions/supabase/functions/select-from-table-with-auth-rls/index.ts
@@ -2,7 +2,7 @@
// https://deno.land/manual/getting_started/setup_your_environment
// This enables autocomplete, go to definition, etc.
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:supabase-js@2'
import { corsHeaders } from '../_shared/cors.ts'
console.log(`Function "select-from-table-with-auth-rls" up and running!`)
diff --git a/examples/edge-functions/supabase/functions/sentry/index.ts b/examples/edge-functions/supabase/functions/sentry/index.ts
index ecdf4bb511d..93079b1c34d 100644
--- a/examples/edge-functions/supabase/functions/sentry/index.ts
+++ b/examples/edge-functions/supabase/functions/sentry/index.ts
@@ -4,7 +4,7 @@
console.log('Hello from the Sentry Functions Challenge!')
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:supabase-js@2'
import * as Sentry from 'https://deno.land/x/[email protected]/index.mjs'
const supabase = createClient(
diff --git a/examples/edge-functions/supabase/functions/upstash-redis-ratelimit/index.ts b/examples/edge-functions/supabase/functions/upstash-redis-ratelimit/index.ts
index 91774d9cc22..d3be9df320c 100644
--- a/examples/edge-functions/supabase/functions/upstash-redis-ratelimit/index.ts
+++ b/examples/edge-functions/supabase/functions/upstash-redis-ratelimit/index.ts
@@ -1,6 +1,6 @@
import { Redis } from 'https://deno.land/x/[email protected]/mod.ts'
import { Ratelimit } from 'https://cdn.skypack.dev/@upstash/[email protected]'
-import { createClient } from 'jsr:@supabase/supabase-js@2'
+import { createClient } from 'npm:supabase-js@2'
console.log(`Function "upstash-redis-counter" up and running!`)