I seem to have gotten farther than most here on this exact issue.
Unfortunately haven’t cracked it yet.
https://github.com/nextauthjs/next-auth/discussions/12022
TLDR is it’s working for me only in ui mode and only on the 2nd and subsequent test runs.
Absolutely no idea why the cookie behaves like this.