Open SerenModz21 opened 2 weeks ago
Did you use pages router?
No, I use the app router.
Can you provide repo or example?
Unfortunately, the repo for the project that I work on is private. However, I will make a new repo to hopefully reproduce it.
Here is a repo that reproduces the issue: https://github.com/SerenModz21/isomorphic-next-reproduction
By the way, not that this is to do with this issue, your typecasting for getAll is completely changing the actual return type. You're telling typescript to return a Record but it's an object array. For example: { name: string; value: string }[]
This can lead to confusion when people try to use Object.entries()
for what they'll believe is an object, when it's an array already. It happened to me and had to typecast it back to its correct object array.
I'll also check that issue.
After having a proper look, I found that cookie.parse()
returns an object (as per the string record type currently), while Next's cookies().getAll()
is an array of objects as mentioned in my previous comment.
To resolve the type conflict, you could either have it return a union type or format one of the outputs to match the other.
type definition issue has been resolved. Please check version 0.0.2.
We are currently investigating the issue: Error: Cannot find module 'next/headers'.
When I deploy my Next.js application to production, isomorphic-next fails to find
next/headers
:Versions: next 14.2.13 isomorphic-next 0.0.1-Prerelease
I'm specifically stating that it isomorphic-next failing to find it because I use the cookies function from
next/headers
in parts of my codebase, to check if a cookie exists. That code works fine but when isomorphic-next tries to require it, it fails to find it.The only thing I can think of is that Next.js modifies
next/headers
imports at build time.If it's worth noting, I deploy my application using Docker and with a standalone build.