19 Sept 2024
I’ve encountered this issue quite a few times when trying to manage cookies using the app router. Everything flows smoothly in local development, but when the site is deployed, things just fall apart. I tried using Server Actions and route handlers, hoping for a breakthrough, but nothing stuck.
Eventually, I found a temporary solution around it by creating an API through the pages router—/api
—to handle cookie setting and deletion. That’s where things finally clicked into place. If you’re hitting a wall like I did, try shifting to this temporary approach. It might be the missing piece you've been hunting for.