Using await cookies() inside middleware
Unanswered
Silky ant posted this in #help-forum
Silky antOP
We have a library that works with cookies from within the user's middleware. Our guidance is for them to pass down
- As soon as we move our library to use
Even though we have request in the middleware available, so this is in essence a non-issue for us, this makes me feel like this is a bug in turbopack that I wanted to see if someone has any information here before I report it.
I can work on a reproduction, but given this requires a library etc I wanted to first give it a shot and see if this is known or not. Alternatively, our library is opensource, so i could share it, but it's ofcourse nothing minimal (which i tend to avoid for reproductions).
Thanks
request
to the library. However, we noticed weird behavior when they do not pass down the request object in a certain situation and I am interested to figure out if this is a bug or not:- As soon as we move our library to use
type="module"
, with moduleResolution=NodeNext
and module=NodeNext
, we notice that await cookies()
can no longer write to cookies when using --turbopack
. Once we drop --turbopack
, or when we do a production build, everything works fine again.Even though we have request in the middleware available, so this is in essence a non-issue for us, this makes me feel like this is a bug in turbopack that I wanted to see if someone has any information here before I report it.
I can work on a reproduction, but given this requires a library etc I wanted to first give it a shot and see if this is known or not. Alternatively, our library is opensource, so i could share it, but it's ofcourse nothing minimal (which i tend to avoid for reproductions).
Thanks