From 340787064687c26f4813028d0c89f4ad41150fd7 Mon Sep 17 00:00:00 2001 From: koksingheww Date: Sun, 8 Oct 2023 00:22:38 +0800 Subject: [PATCH] update supabase-js dependency DynamicServerError --- app/account/page.tsx | 2 +- app/layout.tsx | 4 +--- app/supabase-server.ts | 7 ++++--- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/app/account/page.tsx b/app/account/page.tsx index 3fcffaa..a6ae6ba 100644 --- a/app/account/page.tsx +++ b/app/account/page.tsx @@ -44,7 +44,7 @@ export default async function Account() { const { error } = await supabase .from('users') .update({ full_name: newName }) - .eq('id', user?.id); + .eq('id', user?.id!); if (error) { console.log(error); } diff --git a/app/layout.tsx b/app/layout.tsx index 6947323..a69ad81 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -2,7 +2,6 @@ import SupabaseProvider from './supabase-provider'; import Footer from '@/components/ui/Footer'; import Navbar from '@/components/ui/Navbar'; import { PropsWithChildren } from 'react'; -import type { Metadata } from 'next' import 'styles/globals.scss'; const meta = { @@ -15,7 +14,7 @@ const meta = { type: 'website' }; -export const metadata: Metadata = { +export const metadata = { title: meta.title, description: meta.description, cardImage: meta.cardImage, @@ -49,7 +48,6 @@ export default function RootLayout({ - {/* @ts-expect-error */}
- createServerComponentClient({ cookies }) -); +export const createServerSupabaseClient = cache(() => { + const cookieStore = cookies() + return createServerComponentClient({ cookies: () => cookieStore }) +}) export async function getSession() { const supabase = createServerSupabaseClient(); diff --git a/package-lock.json b/package-lock.json index 0c5e83c..6bb93bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@supabase/auth-helpers-nextjs": "^0.7.0", "@supabase/auth-ui-react": "^0.4.2", "@supabase/auth-ui-shared": "^0.1.6", - "@supabase/supabase-js": "^2.23.0", + "@supabase/supabase-js": "^2.33.2", "classnames": "^2.3.2", "framer-motion": "^10.11.2", "next": "13.4.3", diff --git a/package.json b/package.json index 7a4c42f..b874bd1 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "@supabase/auth-helpers-nextjs": "^0.7.0", "@supabase/auth-ui-react": "^0.4.2", "@supabase/auth-ui-shared": "^0.1.6", - "@supabase/supabase-js": "^2.23.0", + "@supabase/supabase-js": "^2.33.2", "classnames": "^2.3.2", "@iconify/react": "^4.0.1", "next": "13.4.3",