stackernews / stacker.news

Internet communities that pay you Bitcoin
https://stacker.news
MIT License
432 stars 112 forks source link

Something is wrong with logout + account switching #1573

Closed ekzyis closed 19 hours ago

ekzyis commented 2 days ago

Is there an existing issue for this?

Describe the bug

I just logged out on SN as @ek after possibly having been logged in for a long time and I was also logged in as @oracle since a few days ago using account switching.

However, the logout didn't work (I was still logged in as @ek, at least according to the UI) and I saw some minified React errors in the console. However, I forgot to copy them before I refreshed the page. I have found no error related to this in the server logs searching all log streams of /aws/elasticbeanstalk/sn-env/var/log/web.stdout.log around the time period it happened.

When I refreshed the page, the logout worked. I was now only logged in as @oracle but logging out from that account didn't completely work. It switched to @anon but @anon still showed @oracle as an option to switch but clicking on it didn't work.

I then cleared my cookies and everything worked as expected from there again. I tried to reproduce to no avail.

Screenshots

No response

Steps To Reproduce

???

Expected behavior

logout works even if account switching was used or not

Logs

No response

Device information

No response

Additional context

No response

ekzyis commented 2 days ago

I found this signout error in cloudwatch:

TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
    at new NodeError (node:internal/errors:405:5)
    at Function.from (node:buffer:325:9)
    at d (/var/app/current/.next/server/pages/api/signout.js:1:1479)
    at l (/var/app/current/.next/server/pages/api/signout.js:1:903)
    at K (/var/app/current/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16887)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async U.render (/var/app/current/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17520)
    at async NextNodeServer.runApi (/var/app/current/node_modules/next/dist/server/next-server.js:598:9)
    at async NextNodeServer.handleCatchallRenderRequest (/var/app/current/node_modules/next/dist/server/next-server.js:269:37)
    at async NextNodeServer.handleRequestImpl (/var/app/current/node_modules/next/dist/server/base-server.js:817:17) {
    code: 'ERR_INVALID_ARG_TYPE'
}

This happens when you logout and for some reason, req.cookies.multi_auth is undefined.