Next.js Discord

Discord Forum

Github actions next build generate error

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
Hell, I am setting up a CI which has each push on a branch of dev, build and sends the generated code to vercel using this doc. https://vercel.com/guides/how-can-i-use-github-actions-with-vercel


But I have an error at build time when in a page or in the RootLayout I import a client component.
When I remove the client component from Pages or RootLayout the build goes well and is deployed on vercel.

Error: screen
My CI: screen

My code:
Provider:
'use client';

import { SessionProvider } from 'next-auth/react';
import { ReactNode } from 'react';

type ProviderProps = {
  children: ReactNode;
};

const Provider = ({ children }: ProviderProps) => {
  return <SessionProvider>{children}</SessionProvider>;
};

export default Provider;


RootLayout:
import Provider from '@/component/provider';
import './globals.css';
import type { Metadata } from 'next';
import { Inter } from 'next/font/google';

const inter = Inter({ subsets: ['latin'] });

export const metadata: Metadata = {
  title: 'Create Next App',
  description: 'Generated by create next app'
};

export default function RootLayout({
  children
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body className={inter.className}>
        <Provider>
          <main className="mx-auto max-w-5xl text-2xl flex gap-2 text-white">
            {children}
          </main>
        </Provider>
      </body>
    </html>
  );
}

0 Replies