doesnt compile
Answered
Erythrina gall wasp posted this in #help-forum
Erythrina gall waspOP
✓ Starting...
✓ Ready in 4.3s
its stuck here40 Replies
it is supposed to be there
Answer
wdym it doesn't compile
Erythrina gall waspOP
No its stuck there
Isnt it supposed to show
/compiling ?
Erythrina gall waspOP
Yes
This doesnt come
only if you access the page
Erythrina gall waspOP
Ohh
My bad
😔
Ima try rhat
Wait
"use client";
import { ClerkProvider, useAuth } from "@clerk/nextjs";
import { AuthLoading, Authenticated, ConvexReactClient, Unauthenticated } from "convex/react";
import { ConvexProviderWithClerk } from "convex/react-clerk";
interface ConvexClientProviderProps {
children: React.ReactNode;
};
const convexUrl = process.env.NEXT_PUBLIC_CONVEX_URL!;
const convex = new ConvexReactClient(convexUrl);
export const ConvexClientProvider = ({
children
}: ConvexClientProviderProps) => {
return (
<ClerkProvider afterSignUpUrl="/sign-up">
<ConvexProviderWithClerk useAuth={useAuth} client={convex}>
{/* <AuthLoading>
<Loading />
</AuthLoading> */}
<Authenticated>
{children}
</Authenticated>
<Unauthenticated>
{children}
</Unauthenticated>
</ConvexProviderWithClerk>
</ClerkProvider>
)
}
i have a convex provider
but
it doesnt direct me to the sign up page
why is that?
i don't think env vars can be accessed by client
@Diamond Master i don't think env vars can be accessed by client
Erythrina gall waspOP
ooooo
okay
try to manually put the string for now
and check
@Diamond Master try to manually put the string for now
Erythrina gall waspOP
still doesnt work
:(
i never used Convex, srry
try to check the console
Erythrina gall waspOP
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { ConvexClientProvider } from "@/providers/convex-client-provider";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<ConvexClientProvider>
{children}
</ConvexClientProvider>
</body>
</html>
);
}
or remove that "use client"
Erythrina gall waspOP
is it due to the layout?
@Diamond Master or remove that "use client"
Erythrina gall waspOP
it shows an error when i do that
which one
Erythrina gall waspOP
Server Error
TypeError: createContext only works in Client Components. Add the "use client" directive at the top of the file to use it. Read more: https://nextjs.org/docs/messages/context-in-server-component
idk then, srry
Erythrina gall waspOP
its okay
dont worry :)
Asian black bear
Please don't use a single thread for chaining multiple issues. Second, you should read up on the Convex docs how to set it up and in case you have issues open another thread with a descriptive title and sufficient details for others to help you.