-
Link to the code that reproduces this issuehttps://github.com/Dannymx/shockinglemon.com/tree/develop To Reproduce
Current vs. Expected behaviorFails at validating types in generateMetadata methods. Provide environment information❯ npx --no-install next info
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.0.0: Tue Sep 24 23:37:25 PDT 2024; root:xnu-11215.1.12~1/RELEASE_ARM64_T6030
Available memory (MB): 36864
Available CPU cores: 12
Binaries:
Node: 20.17.0
npm: 10.8.2
Yarn: 1.22.22
pnpm: 9.10.0
Relevant Packages:
next: 15.0.1 // Latest available version is detected (15.0.1).
eslint-config-next: 15.0.1
react: 18.3.1
react-dom: 18.3.1
typescript: 5.6.3
Next.js Config:
output: N/A Which area(s) are affected? (Select all that apply)TypeScript Which stage(s) are affected? (Select all that apply)next dev (local), next build (local) Additional contextOnly fails in my dynamic pages that generate Metadata info.
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 7 replies
-
This is part of the breaking changes that came with v15. |
Beta Was this translation helpful? Give feedback.
-
I fixed it by converting params to a Promise For example before i did this
Now I do this
|
Beta Was this translation helpful? Give feedback.
-
Here’s how I fix this issse:import Link from "next/link";
import photos, { Photo } from "@/lib/";
import PhotoCard from "@/components/photo-card";
export const generateStaticParams = () => {
return photos.map(({ id }) => ({
id: String(id),
}));
};
export type paramsType = Promise<{ id: string }>;
export default async function PhotoPage(props: { params: paramsType }) {
const { id } = await props.params;
const photo: Photo | undefined = photos.find((p) => p.id === id);
if (!photo) {
return <div>Photo not found</div>;
}
return (
<section className="py-24">
<div className="container">
<div>
<Link
href="/photos"
className="font-semibold italic text-sky-600 underline"
>
Back to photos
</Link>
</div>
<div className="mt-10 w-1/3">
<PhotoCard photo={photo} />
</div>
</div>
</section>
);
} |
Beta Was this translation helpful? Give feedback.
-
so what am I doing wrong? The error won't go away for me. |
Beta Was this translation helpful? Give feedback.
-
import { format } from 'date-fns'; // Définition du type pour params comme une promesse // Composant avec params comme Promise
}; export default BillboardsPage; |
Beta Was this translation helpful? Give feedback.
-
Here’s how I fix this issue: Previously it looked like this: export default async function Page({
params,
}: {
params: { slug: string };
}) {
const slug = params.slug;
const response = await getProjectBySlug(slug); Then, I changed it to: export default async function Page(props: {
params: Promise<{ slug: string }>;
}) {
const params = await props.params;
const response = await getProjectBySlug(params.slug); |
Beta Was this translation helpful? Give feedback.
-
Theres a script that fixes the Params breaking chamnge in the project, the easiest solution: First commit an leade stage clean, then run Refer to: https://nextjs.org/blog/next-15#async-request-apis-breaking-change |
Beta Was this translation helpful? Give feedback.
-
import ProductListing from "../../components/product-listing"; const currentPage = searchParams.page ? parseInt(searchParams.page) - 1 : 0; const fetchCategoryDetails = async (id: number) => {
}; const getPlp = async (id: number, currentPage: number, count: number) => {
}; const breadcrumbData = await fetchCategoryDetails(id); return (
) while building it is showing an error given below Next.js build worker exited with code: 1 and signal: null |
Beta Was this translation helpful? Give feedback.
This is part of the breaking changes that came with v15.