#Next build errors

1 messages · Page 1 of 1 (latest)

frosty iron
#

Hey, after updating next and other packages to the latest ver, im getting a alot of unexpected errors;

Example:

TypeError: Cannot read properties of undefined (reading 'push')
    at Utility_append (C:\Projects\StartAppNext\.next\server\chunks\2274.js:149234:15)
    at lift (C:\Projects\StartAppNext\.next\server\chunks\2274.js:149295:2)
    at C:\Projects\StartAppNext\.next\server\chunks\2274.js:149760:10
    at Array.map (<anonymous>)
    at Utility_combine (C:\Projects\StartAppNext\.next\server\chunks\2274.js:149243:15)
    at Array.prefixer (C:\Projects\StartAppNext\.next\server\chunks\2274.js:149750:14)
    at C:\Projects\StartAppNext\.next\server\chunks\2274.js:603:27
    at Serializer_serialize (C:\Projects\StartAppNext\.next\server\chunks\2274.js:561:13)
    at _stylis (C:\Projects\StartAppNext\.next\server\chunks\2274.js:1439:14)
    at getRules (C:\Projects\StartAppNext\.next\server\chunks\2274.js:1449:35)```

My contact page:
import Form from './Form'

const ContactPage = () => {
    return (
        <div className='min-h-[90vh] bg-slate-200 relative'>
            <div className='w-full min-h-full flex justify-center items-center'>
                <div className='absolute right-52 top-[12rem] h-[28rem] w-[28rem] blur-[90px] opacity-40 block bg-gradient-to-r from-indigo-500 to-pink-500' />
                <div className='absolute left-52 bottom-2 h-[28rem] w-[28rem] blur-[90px] opacity-40 block bg-gradient-to-r from-indigo-500 to-pink-500' />
                <div className='bg-white bg-opacity-50 shadow-lg shadow-black/5 flex flex-col py-12 px-8 items-center rounded-2xl w-50 bg-clip-padding backdrop-filter backdrop-blur-3xl border border-gray-200/70 container my-32 h-full'>
                    <h1 className='text-5xl font-bold duration-300 text-gray-800'>....</h1>
                    <h4 className='font-medium text-base duration-300 mb-8 mt-2 text-slate-600'>
                    ....
                    </h4>
                    <Form />
                </div>
            </div>
        </div>
    )
}

export const metadata = {
    title: `${process.env.NEXT_PUBLIC_WEBSITE_NAME} | Contact`,
}

export default ContactPage

`app\(main)\contact\page.tsx`

Thanks!
slender wolfBOT
#

Hi @frosty iron. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Hmm, I don't know enough to give you a confident answer yet. The error message you're seeing seems to be related to a push operation on an undefined object, but without more context, it's hard to pinpoint the exact issue.

However, I can provide some general advice based on the information you've provided.

  1. Check your package versions: Make sure you're using compatible versions of Next.js and other related packages. For instance, if you're using TypeScript, you should be using TypeScript 5.1.3 or higher and @types/react 18.2.8 or higher to avoid certain types of errors (source (https://nextjs.org/docs/app/building-your-application/configuring/typescript)).

  2. Review your CSS: If you've recently upgraded to Next.js 12, note that next/image now renders the <img> inside a <span> instead of <div>. If your application has specific CSS targeting these elements, you might need to update your selectors (source (https://nextjs.org/docs/pages/building-your-application/upgrading/version-12)).

  3. Inspect your data fetching methods: If you've migrated from pages to app, make sure you've correctly updated your data fetching methods. The pages directory uses getServerSideProps and getStaticProps to fetch data for pages, but inside the app directory, these are replaced with a simpler API built on top of fetch() and async React Server Components (source (https://nextjs.org/docs/pages/building-your-application/upgrading/app-router-migration)).

If none of these suggestions help, I recommend checking out the Next.js documentation (https://nextjs.org/docs) for more information or reaching out to the Next.js community for support.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@frosty iron kapa.ai is still learning and improving, please let us how it did by reacting below

frosty iron
#

@slender wolf The push error related to mui textField component, and I did mirigrate to the app directory but my api is on the pages router still.

slender wolfBOT
#

Let me check the knowledge base for you. One moment! :books:

#

Based on the information you've provided, it seems like the error might be related to the Material-UI TextField component. However, without more specific details about how you're using the TextField component, it's hard to provide a precise solution.

Here are a few general suggestions:

  1. Check your TextField usage: Make sure you're using the TextField component correctly according to the Material-UI documentation. For example, ensure that the value and onChange props are correctly set.

  2. Inspect your API routes: If you've migrated to the app directory but your API routes are still in the pages directory, make sure they're still working as expected. API Routes continue to work in the pages/api directory without any changes. However, they have been replaced by Route Handlers in the app directory (source (https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration)).

  3. Consider migrating API routes: If you're using API routes to call an external API from the client, you can now use Server Components instead to securely fetch data (source (https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration)).

If these suggestions don't help, I recommend checking out the Next.js documentation (https://nextjs.org/docs) and the Material-UI documentation (https://mui.com/components/text-fields/) for more information.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: