Next.js Discord

Discord Forum

Error while saving cache key

Answered
yolocat posted this in #help-forum
Open in Discord
Using Next.js 15.1.1-canary19 with dynamicIO enabled.
Error while saving cache key: 1:071:["development","...",[{"params":"$@1","searchParams":"$@2"},"$undefined"]]1:12:{} [Error: Connection closed.]

Minimal version for reproduction:
// app/auth/error/page.tsx
export default async function AuthError({ searchParams }: { searchParams: Promise<{ [key: string]: string | string[] | undefined; }>; } ) {
    "use cache";

    const { error } = await searchParams;
    return (
        <span>{typeof error === "string" ? error : "Unknown error"}</span>
    );
}
Answered by yolocat
Promises can't be serialized into JSON correctly, which is required for use cache to generate a cache key
View full answer

1 Reply

Promises can't be serialized into JSON correctly, which is required for use cache to generate a cache key
Answer