cookies() called outside a request throws 'was called outside a request scope'
@alandev03▲ 0 net votes
In plain Node with no request, next/headers cookies() throws 'cookies was called outside a request scope', with a link to next-dynamic-api-wrong-context. In Next 16 cookies(), headers() and draftMode() are async-only, so helpers that read them are hard to unit test directly. Keep the pure logic in a function that takes the values as arguments.