hoarder-app / hoarder

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
https://hoarder.app
GNU Affero General Public License v3.0
6.48k stars 235 forks source link

Getting logged out all the time #564

Closed wouldntyouknow closed 1 month ago

wouldntyouknow commented 1 month ago

Hi! Love the app but I am having an issue with it. After logging in successfully, I get logged out automatically after a minute or two (seemingly random). When I try to get back it, sometimes it fails a few times, sometimes it lets me in instantly. Running the app in Docker, locally. Here is a log excerpt. This chunk comes up 6-7 times (same) in a row after getting kicked out.

s [TRPCError]: UNAUTHORIZED

    at /app/apps/web/.next/server/chunks/815.js:1:2403

    at a (/app/apps/web/.next/server/chunks/105.js:4:32966)

    at Object.next (/app/apps/web/.next/server/chunks/105.js:4:33078)

    at /app/apps/web/.next/server/chunks/815.js:1:2337

    at a (/app/apps/web/.next/server/chunks/105.js:4:32966)

    at p (/app/apps/web/.next/server/chunks/105.js:4:33305)

    at h (/app/apps/web/.next/server/chunks/105.js:7:4283)

    at /app/apps/web/.next/server/app/api/trpc/[trpc]/route.js:1:4249

    at Array.map (<anonymous>)

    at g (/app/apps/web/.next/server/app/api/trpc/[trpc]/route.js:1:4183) {

  code: 'UNAUTHORIZED',

  [cause]: undefined

}

What can I do here? THank you.

MohamedBassem commented 1 month ago

do you have something in front of hoarder? A reverse proxy with any special configuration for example?

wouldntyouknow commented 1 month ago

Hi! No, not yet at least. I am trying to access it on my internal docker IP (something like 'http://192.168.0.25:portnum')

MohamedBassem commented 1 month ago

that's weird. Is this happening with other browsers as well? Also are you using passwords or oauth?

wouldntyouknow commented 1 month ago

I am using Brave. Will test now in chrome. Just noticed that these chunks actually differ a bit. So here is the part for the last logout event. This time I got 3 of these (what I called) "chunks". Also, I am using username/password.

`2024-10-17T21:26:43.626647179Z s [TRPCError]: UNAUTHORIZED

2024-10-17T21:26:43.626699943Z     at /app/apps/web/.next/server/chunks/815.js:1:2403

2024-10-17T21:26:43.626705810Z     at a (/app/apps/web/.next/server/chunks/105.js:4:32966)

2024-10-17T21:26:43.626709141Z     at Object.next (/app/apps/web/.next/server/chunks/105.js:4:33078)

2024-10-17T21:26:43.626719709Z     at /app/apps/web/.next/server/chunks/815.js:1:2337

2024-10-17T21:26:43.626722231Z     at a (/app/apps/web/.next/server/chunks/105.js:4:32966)

2024-10-17T21:26:43.626724364Z     at p (/app/apps/web/.next/server/chunks/105.js:4:33305)

2024-10-17T21:26:43.626731087Z     at s (/app/apps/web/.next/server/chunks/105.js:7:4427)

2024-10-17T21:26:43.626733270Z     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

2024-10-17T21:26:43.626735569Z     at async i (/app/apps/web/.next/server/app/dashboard/tags/page.js:1:34072) {

2024-10-17T21:26:43.626737840Z   code: 'UNAUTHORIZED',

2024-10-17T21:26:43.626739901Z   digest: '426706303',

2024-10-17T21:26:43.626741997Z   [cause]: undefined

2024-10-17T21:26:43.626744080Z }

2024-10-17T21:26:44.582417038Z s [TRPCError]: UNAUTHORIZED

2024-10-17T21:26:44.582449101Z     at /app/apps/web/.next/server/chunks/815.js:1:2403

2024-10-17T21:26:44.582452624Z     at a (/app/apps/web/.next/server/chunks/105.js:4:32966)

2024-10-17T21:26:44.582455060Z     at Object.next (/app/apps/web/.next/server/chunks/105.js:4:33078)

2024-10-17T21:26:44.582457453Z     at /app/apps/web/.next/server/chunks/815.js:1:2337

2024-10-17T21:26:44.582459629Z     at a (/app/apps/web/.next/server/chunks/105.js:4:32966)

2024-10-17T21:26:44.582461781Z     at p (/app/apps/web/.next/server/chunks/105.js:4:33305)

2024-10-17T21:26:44.582463825Z     at h (/app/apps/web/.next/server/chunks/105.js:7:4283)

2024-10-17T21:26:44.582465953Z     at /app/apps/web/.next/server/app/api/trpc/[trpc]/route.js:1:4249

2024-10-17T21:26:44.582468083Z     at Array.map (<anonymous>)

2024-10-17T21:26:44.582470435Z     at g (/app/apps/web/.next/server/app/api/trpc/[trpc]/route.js:1:4183) {

2024-10-17T21:26:44.582472558Z   code: 'UNAUTHORIZED',

2024-10-17T21:26:44.582474599Z   [cause]: undefined

2024-10-17T21:26:44.582476521Z }

2024-10-17T21:26:45.604977951Z s [TRPCError]: UNAUTHORIZED

2024-10-17T21:26:45.605005483Z     at /app/apps/web/.next/server/chunks/815.js:1:2403

2024-10-17T21:26:45.605009103Z     at a (/app/apps/web/.next/server/chunks/105.js:4:32966)

2024-10-17T21:26:45.605012178Z     at Object.next (/app/apps/web/.next/server/chunks/105.js:4:33078)

2024-10-17T21:26:45.605014582Z     at /app/apps/web/.next/server/chunks/815.js:1:2337

2024-10-17T21:26:45.605016689Z     at a (/app/apps/web/.next/server/chunks/105.js:4:32966)

2024-10-17T21:26:45.605018788Z     at p (/app/apps/web/.next/server/chunks/105.js:4:33305)

2024-10-17T21:26:45.605020803Z     at h (/app/apps/web/.next/server/chunks/105.js:7:4283)

2024-10-17T21:26:45.605022900Z     at /app/apps/web/.next/server/app/api/trpc/[trpc]/route.js:1:4249

2024-10-17T21:26:45.605025085Z     at Array.map (<anonymous>)

2024-10-17T21:26:45.605039455Z     at g (/app/apps/web/.next/server/app/api/trpc/[trpc]/route.js:1:4183) {

2024-10-17T21:26:45.605042357Z   code: 'UNAUTHORIZED',

2024-10-17T21:26:45.605044473Z   [cause]: undefined

2024-10-17T21:26:45.605046526Z }`
wouldntyouknow commented 1 month ago

Also an addition I missed: In the same browser (Brave), the Hoarder extension is installed and active. Configured via username and password as well. It works, adds the resource properly to Hoarder.

MohamedBassem commented 1 month ago

The extension uses a different authentication mechanism (API key based). How did the testing go with chrome?

wouldntyouknow commented 1 month ago

Okay, so Chrome is still in, while Brave had me kicked. Clearing cookies and retest did not seemed to help - same issue for some reason... Strange. Anyways, I guess this means it does not have to do anything with Hoarder, the issue is on my end. Thanks for such quick replies!

MohamedBassem commented 1 month ago

@wouldntyouknow to give you some leads. This behavior you're seeing means that brave for some reason is not sending/corrupting the the JWT in the cookie that hoarder sets. If the JWT is corrupt, hoarder fails to authenticate you and just logs you out.

wouldntyouknow commented 1 month ago

Thanks again! Whatever it is, it is local to this particular installation as it seems. Fired up a W10 VM that has the same brave version - it works there perfectly.

MohamedBassem commented 1 month ago

Could be some extensions you have or something. Closing this issue for now, as it seems resolved. Feel free to reopen if you have more questions.