Skip to content

TypeError: Cannot create property 'digest' on string 'Something went wrong!': Next.js deployment on Vercel. #11899

Open
@ProspDev

Description

@ProspDev

Describe the Bug

Environment info.
node: 20.18.0
next.js: 14.2.22

I wanted to deploy the next.js + TS project on vercel, but I got this error.
TypeError: Cannot create property 'digest' on string 'Something went wrong!'

My project is using app router.
It occurs in app/product/[id]/error.tsx

The code is as following.

`'use client';

import Button from '@mui/material/Button';
import Container from '@mui/material/Container';

import { paths } from 'src/routes/paths';
import { RouterLink } from 'src/routes/components';

import { Iconify } from 'src/components/iconify';
import { EmptyContent } from 'src/components/empty-content';

// ----------------------------------------------------------------------

export default function Error({
  error,
  reset,
}: {
  error: Error & { digest?: string };
  reset: () => void;
}) {
  return (
    <Container sx={{ mt: 5, mb: 10 }}>
      <EmptyContent
        filled
        title="Product not found!"
        action={
          <Button
            component={RouterLink}
            href={paths.product.root}
            startIcon={<Iconify width={16} icon="eva:arrow-ios-back-fill" />}
            sx={{ mt: 3 }}
          >
            Back to list
          </Button>
        }
        sx={{ py: 10 }}
      />
    </Container>
  );
}`

On local env, there is no bug, but on deployment, this issue occured.

Please help to fix this issue.
Thanks.

Link to the code that reproduces this issue

yarn install, yarn build, yarn start.

Reproduction Steps

No response.

Which area(s) are affected? (Select all that apply)

Not sure

Environment Info

node: 20.18.0
next.js: 14.2.22

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions