sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

`generateMetadata` breaks `cacheComponents` on turbopack

Open chargome opened this issue 1 month ago • 2 comments

Description

ref https://github.com/getsentry/sentry-javascript/issues/17895

chargome avatar Dec 03 '25 09:12 chargome

JS-1250

linear[bot] avatar Dec 03 '25 09:12 linear[bot]

For the time being we only experienced this error when running the dev server, not any production build.

chargome avatar Dec 03 '25 10:12 chargome

it is happening in dev and production

joacub avatar Dec 17 '25 00:12 joacub

@joacub are you building with turbopack?

chargome avatar Dec 17 '25 08:12 chargome

Turbopack and error in production

albertocubeddu avatar Dec 17 '25 09:12 albertocubeddu

@albertocubeddu could you provide a reproduction where this breaks in prod?

chargome avatar Dec 17 '25 14:12 chargome

@joacub are you building with turbopack?

yes in both dev and prod

joacub avatar Dec 18 '25 01:12 joacub

aks in prod?

any segment that use async generateMetadata will fail

import AffiliatesGeneral from '@wsy/ui/AffiliatesGeneral/AffiliatesGeneral';

import { Metadata } from 'next';
import { openGraph, twitter } from '@wsy/web/shared-metadata';
import translate from '../../../translate';

export async function generateMetadata({ params }): Promise<Metadata> {
  const titleLocale = await translate({
    locale: (await params).lang,

    id: 'affiliateProgramTermsAndConditions',
    defaultMessage: 'Affiliate Program Terms and Conditions ',
  });
  const title = titleLocale.format() as string;
  return {
    title,
    openGraph: {
      ...openGraph,
      title,
    },
    twitter: {
      ...twitter,
      title,
    },
  };
}

const Page = () => {
  return <AffiliatesGeneral />;
};

export default Page;

joacub avatar Dec 18 '25 01:12 joacub