Replace createServerClient with createClient in multiple files (#30)
The `createServerClient` function has been replaced with the `createClient` function in the `server-actions.client.ts`, `route-handler.client.ts`, and `server-component.client.ts` files. This includes adding necessary import statements for `createClient` and adjusting the options passed to it, including `persistSession`, `detectSessionInUrl`, and `autoRefreshToken`.
This commit is contained in:
committed by
GitHub
parent
cbf116c688
commit
7f4bfb15e5
@@ -56,7 +56,7 @@
|
|||||||
"@radix-ui/react-icons": "^1.3.0",
|
"@radix-ui/react-icons": "^1.3.0",
|
||||||
"@supabase/supabase-js": "^2.43.4",
|
"@supabase/supabase-js": "^2.43.4",
|
||||||
"@tanstack/react-query": "5.40.0",
|
"@tanstack/react-query": "5.40.0",
|
||||||
"@tanstack/react-query-next-experimental": "^5.39.0",
|
"@tanstack/react-query-next-experimental": "^5.40.0",
|
||||||
"@tanstack/react-table": "^8.17.3",
|
"@tanstack/react-table": "^8.17.3",
|
||||||
"date-fns": "^3.6.0",
|
"date-fns": "^3.6.0",
|
||||||
"lucide-react": "^0.379.0",
|
"lucide-react": "^0.379.0",
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
"dotenv-cli": "^7.4.2",
|
"dotenv-cli": "^7.4.2",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.5",
|
||||||
"supabase": "^1.169.6",
|
"supabase": "^1.169.8",
|
||||||
"tailwindcss": "3.4.3",
|
"tailwindcss": "3.4.3",
|
||||||
"typescript": "^5.4.5"
|
"typescript": "^5.4.5"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import 'server-only';
|
|||||||
import { unstable_noStore as noStore } from 'next/cache';
|
import { unstable_noStore as noStore } from 'next/cache';
|
||||||
import { cookies } from 'next/headers';
|
import { cookies } from 'next/headers';
|
||||||
|
|
||||||
|
import { createClient } from '@supabase/supabase-js';
|
||||||
|
|
||||||
import type { CookieOptions } from '@supabase/ssr';
|
import type { CookieOptions } from '@supabase/ssr';
|
||||||
import { createServerClient } from '@supabase/ssr';
|
import { createServerClient } from '@supabase/ssr';
|
||||||
|
|
||||||
@@ -31,11 +33,12 @@ export function getSupabaseRouteHandlerClient<GenericSchema = Database>(
|
|||||||
if (params.admin) {
|
if (params.admin) {
|
||||||
warnServiceRoleKeyUsage();
|
warnServiceRoleKeyUsage();
|
||||||
|
|
||||||
return createServerClient<GenericSchema>(keys.url, serviceRoleKey, {
|
return createClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||||
auth: {
|
auth: {
|
||||||
persistSession: false,
|
persistSession: false,
|
||||||
|
autoRefreshToken: false,
|
||||||
|
detectSessionInUrl: false,
|
||||||
},
|
},
|
||||||
cookies: {},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import 'server-only';
|
|||||||
import { unstable_noStore as noStore } from 'next/cache';
|
import { unstable_noStore as noStore } from 'next/cache';
|
||||||
import { cookies } from 'next/headers';
|
import { cookies } from 'next/headers';
|
||||||
|
|
||||||
|
import { createClient } from '@supabase/supabase-js';
|
||||||
|
|
||||||
import { createServerClient } from '@supabase/ssr';
|
import { createServerClient } from '@supabase/ssr';
|
||||||
|
|
||||||
import { Database } from '../database.types';
|
import { Database } from '../database.types';
|
||||||
@@ -35,11 +37,12 @@ export function getSupabaseServerActionClient<
|
|||||||
if (admin) {
|
if (admin) {
|
||||||
warnServiceRoleKeyUsage();
|
warnServiceRoleKeyUsage();
|
||||||
|
|
||||||
return createServerClient<GenericSchema>(keys.url, serviceRoleKey, {
|
return createClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||||
auth: {
|
auth: {
|
||||||
persistSession: false,
|
persistSession: false,
|
||||||
|
detectSessionInUrl: false,
|
||||||
|
autoRefreshToken: false,
|
||||||
},
|
},
|
||||||
cookies: {},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import 'server-only';
|
|||||||
import { unstable_noStore as noStore } from 'next/cache';
|
import { unstable_noStore as noStore } from 'next/cache';
|
||||||
import { cookies } from 'next/headers';
|
import { cookies } from 'next/headers';
|
||||||
|
|
||||||
|
import { createClient } from '@supabase/supabase-js';
|
||||||
|
|
||||||
import { createServerClient } from '@supabase/ssr';
|
import { createServerClient } from '@supabase/ssr';
|
||||||
|
|
||||||
import { Database } from '../database.types';
|
import { Database } from '../database.types';
|
||||||
@@ -30,12 +32,12 @@ export function getSupabaseServerComponentClient<GenericSchema = Database>(
|
|||||||
if (params.admin) {
|
if (params.admin) {
|
||||||
warnServiceRoleKeyUsage();
|
warnServiceRoleKeyUsage();
|
||||||
|
|
||||||
return createServerClient<GenericSchema>(keys.url, serviceRoleKey, {
|
return createClient<GenericSchema>(keys.url, serviceRoleKey, {
|
||||||
auth: {
|
auth: {
|
||||||
persistSession: false,
|
persistSession: false,
|
||||||
autoRefreshToken: false,
|
autoRefreshToken: false,
|
||||||
|
detectSessionInUrl: false,
|
||||||
},
|
},
|
||||||
cookies: {},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
22
pnpm-lock.yaml
generated
22
pnpm-lock.yaml
generated
@@ -127,8 +127,8 @@ importers:
|
|||||||
specifier: 5.40.0
|
specifier: 5.40.0
|
||||||
version: 5.40.0(react@18.3.1)
|
version: 5.40.0(react@18.3.1)
|
||||||
'@tanstack/react-query-next-experimental':
|
'@tanstack/react-query-next-experimental':
|
||||||
specifier: ^5.39.0
|
specifier: ^5.40.0
|
||||||
version: 5.39.0(@tanstack/react-query@5.40.0(react@18.3.1))(next@14.2.3(@opentelemetry/api@1.8.0)(@playwright/test@1.44.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
|
version: 5.40.0(@tanstack/react-query@5.40.0(react@18.3.1))(next@14.2.3(@opentelemetry/api@1.8.0)(@playwright/test@1.44.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)
|
||||||
'@tanstack/react-table':
|
'@tanstack/react-table':
|
||||||
specifier: ^8.17.3
|
specifier: ^8.17.3
|
||||||
version: 8.17.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
version: 8.17.3(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
@@ -212,8 +212,8 @@ importers:
|
|||||||
specifier: ^3.2.5
|
specifier: ^3.2.5
|
||||||
version: 3.2.5
|
version: 3.2.5
|
||||||
supabase:
|
supabase:
|
||||||
specifier: ^1.169.6
|
specifier: ^1.169.8
|
||||||
version: 1.169.6
|
version: 1.169.8
|
||||||
tailwindcss:
|
tailwindcss:
|
||||||
specifier: 3.4.3
|
specifier: 3.4.3
|
||||||
version: 3.4.3(ts-node@10.9.2(@types/node@20.12.12)(typescript@5.4.5))
|
version: 3.4.3(ts-node@10.9.2(@types/node@20.12.12)(typescript@5.4.5))
|
||||||
@@ -3791,10 +3791,10 @@ packages:
|
|||||||
'@tanstack/query-core@5.40.0':
|
'@tanstack/query-core@5.40.0':
|
||||||
resolution: {integrity: sha512-eD8K8jsOIq0Z5u/QbvOmfvKKE/XC39jA7yv4hgpl/1SRiU+J8QCIwgM/mEHuunQsL87dcvnHqSVLmf9pD4CiaA==}
|
resolution: {integrity: sha512-eD8K8jsOIq0Z5u/QbvOmfvKKE/XC39jA7yv4hgpl/1SRiU+J8QCIwgM/mEHuunQsL87dcvnHqSVLmf9pD4CiaA==}
|
||||||
|
|
||||||
'@tanstack/react-query-next-experimental@5.39.0':
|
'@tanstack/react-query-next-experimental@5.40.0':
|
||||||
resolution: {integrity: sha512-96vdfzarxpHjoCn92pOoVRIALZlLkAIpOSsaOzbb3Cxo4KZfofsyEy5PxmBau0zrWV+kV4uFhjelUwOyCNJBDw==}
|
resolution: {integrity: sha512-JOEKhzjF4juzzB7N6T+dc8BX5a6UxR7IUJBbmfRYa+Ju8Ibamw4W6xVWzZmH1mVd0G3XGuhcIKhba80n+iK+EQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@tanstack/react-query': ^5.39.0
|
'@tanstack/react-query': ^5.40.0
|
||||||
next: ^13 || ^14 || ^15
|
next: ^13 || ^14 || ^15
|
||||||
react: 18.3.1
|
react: 18.3.1
|
||||||
|
|
||||||
@@ -7201,8 +7201,8 @@ packages:
|
|||||||
engines: {node: '>=16 || 14 >=14.17'}
|
engines: {node: '>=16 || 14 >=14.17'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
supabase@1.169.6:
|
supabase@1.169.8:
|
||||||
resolution: {integrity: sha512-eSJ1xDFcFqy7EK5TDyC3RwJLzGJyZRgwSAt/CcOHJJ/t+TghS6hfjpyL/R6yqDeGlHo8LBuakdV605EnKSIeZA==}
|
resolution: {integrity: sha512-39vOiK2qZBZXUo0iWIRyJB1DLMk0kNb6iW166uvWRWkKWVaBTOErL510AdD1tVGn+sELsW7erl2vy9qLFmBX0Q==}
|
||||||
engines: {npm: '>=8'}
|
engines: {npm: '>=8'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
|
|
||||||
@@ -11114,7 +11114,7 @@ snapshots:
|
|||||||
|
|
||||||
'@tanstack/query-core@5.40.0': {}
|
'@tanstack/query-core@5.40.0': {}
|
||||||
|
|
||||||
'@tanstack/react-query-next-experimental@5.39.0(@tanstack/react-query@5.40.0(react@18.3.1))(next@14.2.3(@opentelemetry/api@1.8.0)(@playwright/test@1.44.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)':
|
'@tanstack/react-query-next-experimental@5.40.0(@tanstack/react-query@5.40.0(react@18.3.1))(next@14.2.3(@opentelemetry/api@1.8.0)(@playwright/test@1.44.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@tanstack/react-query': 5.40.0(react@18.3.1)
|
'@tanstack/react-query': 5.40.0(react@18.3.1)
|
||||||
next: 14.2.3(@opentelemetry/api@1.8.0)(@playwright/test@1.44.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
next: 14.2.3(@opentelemetry/api@1.8.0)(@playwright/test@1.44.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
@@ -15179,7 +15179,7 @@ snapshots:
|
|||||||
pirates: 4.0.6
|
pirates: 4.0.6
|
||||||
ts-interface-checker: 0.1.13
|
ts-interface-checker: 0.1.13
|
||||||
|
|
||||||
supabase@1.169.6:
|
supabase@1.169.8:
|
||||||
dependencies:
|
dependencies:
|
||||||
bin-links: 4.0.4
|
bin-links: 4.0.4
|
||||||
https-proxy-agent: 7.0.4
|
https-proxy-agent: 7.0.4
|
||||||
|
|||||||
Reference in New Issue
Block a user