Skip to content

Turbopack build error: formatMetadataHeaders causes Turbopack build failure in Next.js 16 canary #7461

@namodynamic

Description

@namodynamic

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @clerk/nextjs@6.36.2 for the project I'm working on.

When building with Next.js 16.1.0-canary.21 and Turbopack enabled, the build fails because formatMetadataHeaders in keyless-custom-headers.js is not recognized as an async function. Making it async resolves the issue.

Here is the diff that solved my problem:

diff --git a/node_modules/@clerk/nextjs/dist/esm/server/keyless-custom-headers.js b/node_modules/@clerk/nextjs/dist/esm/server/keyless-custom-headers.js
index 11ccc7a..8994dad 100644
--- a/node_modules/@clerk/nextjs/dist/esm/server/keyless-custom-headers.js
+++ b/node_modules/@clerk/nextjs/dist/esm/server/keyless-custom-headers.js
@@ -67,7 +67,7 @@ function getNextVersion() {
     return void 0;
   }
 }
-function formatMetadataHeaders(metadata) {
+async function formatMetadataHeaders(metadata) {
   const headers2 = new Headers();
   if (metadata.nodeVersion) {
     headers2.set("Clerk-Node-Version", metadata.nodeVersion);

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions