I think this might be a tricky one to diagnose, but I suddenly seem to have a problem with my local site that I wasn't having on Friday.
When I log in to the site running on localhost, it makes a POST request to /api/users/refresh-token, which produces a 404 and then logs me out.
I'm using the next-payload module to run Payload within my NextJS site, and one of the last things I did was to move the public-facing pages of my site to the old-style pages directory (rather than app) and to implement a preview mode, via /api/preview, so either of those changes could have been responsible I imagine, but a couple of things are confusing me a little:
1. I can see a generated file under /pages/api/[collection]/refresh.ts but the request is for /api/users/refresh-token, so how does this match up?
2. The site is deployed to Vercel and it seems to work fine. That site doesn't make any request to /api/users/refresh-token at all
As I say, I think this might be a difficult one to solve as there seem to be a lot of variables, and probably I've misunderstood how Payload or NextJS works, but if anyone can suggest something to look at or explain why I might be seeing these things it would be much appreciated.
I think you are correct! The page name should likely be
refresh-token
and not
refresh
Hi @jarrod69420 this problem went away for a while but has now returned. I can't log in to my local version of the site. I tried renaming the file from refresh.ts to refresh-token.ts but that changed the error from a 404 to a 403 so I'm guessing it's more complicated than that? I've also updated Payload to 1.8.2. Any ideas what I might be able to do?
Yep, thank you for being persistent. Confirmed bug (inside next-payload), fixed on main - will release today
Thanks @jarrod69420 . What's the process for upgrading to the new version, since I already installed next-payload with the older version? I tried just replacing the refresh-token.ts file but it references a src/middleware directory that I don't have, and presumably some other changes as well.
Actually I might have it sorted. Updated the next-payload module and re-ran the install and it seems to have done the job.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.