Fetch is throwing Error "Headers cannot be modified" when deployed to vercel #63236
-
SummaryHi all, I am working with Next 14.1.3 and App Router. I am using the src folder with typescript. On vercel I receive the following error.
Here is a link to a simple reproduction of the error: And here is the code base: It seems to be related to the appended headers() to the fetch function. Any hints what I could look for? Additional informationNo response Example |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 11 replies
-
What Node version does your Vercel deployment have? Which one do you have locally? Make sure they are around the same version. Meanwhile I take a look at what else could be going on. |
Beta Was this translation helpful? Give feedback.
-
Here are the vercel logs. Hope this helps as well. |
Beta Was this translation helpful? Give feedback.
-
uh that one fixed it. |
Beta Was this translation helpful? Give feedback.
-
Got the same issue.
|
Beta Was this translation helpful? Give feedback.
-
Who has an explanation to what is going on exactly, I am modifying the headers in my middleware and it works fine on local dev but not on vercel prod. The site crashes instantly and throws that headers cannot be modified error |
Beta Was this translation helpful? Give feedback.
-
We have just run into this problem. Replacing |
Beta Was this translation helpful? Give feedback.
-
I'm also experiencing this in Next.js v14.1:
I do know that headers created with the |
Beta Was this translation helpful? Give feedback.
Does it change anything to do
headers: new Headers(headers())
I wonder if internally something has changed on the getter function.