RaunoT / plex-rewind

Present Plex user statistics and habits in a beautiful and organized manner.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read properties of undefined (reading 'id')

EricH9958 opened this issue · comments

Plex Rewind Version

v1.8.6

Description

Returns the following in docker logs:

⨯ Error: 'sharp' is required to be installed in standalone mode for the image optimization to function correctly. Read more at: https://nextjs.org/docs/messages/sharp-missing-in-production
TypeError: Cannot read properties of undefined (reading 'id')
at /app/.next/server/app/rewind/page.js:1:36458
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 2)
at async o (/app/.next/server/app/rewind/page.js:1:36246)
at async m (/app/.next/server/app/rewind/page.js:1:32508)
at async Promise.all (index 0)
at async g (/app/.next/server/app/rewind/page.js:1:33471)

Steps to reproduce

current .env

NODE_ENV=production
2
3 NEXT_PUBLIC_TAUTULLI_URL=http://192.168.1.99:8181
4 TAUTULLI_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
5 NEXT_PUBLIC_OVERSEERR_URL=0.0.0.0:5055
6 OVERSEERR_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxZi1hMmY3LTM5NTJmMzUzZDYwYyk
7 TMDB_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
8 PLEX_HOSTNAME=192.168.1.99
9 PLEX_PORT=32400
10
11 NEXT_PUBLIC_SITE_URL=http://192.168.1.99:8383
12 NEXTAUTH_URL=http://192.168.1.99:8383
13 NEXTAUTH_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
14
15 NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=
16 NEXT_PUBLIC_IS_REWIND_DISABLED=false
17 NEXT_PUBLIC_IS_DASHBOARD_DISABLED=false
18 NEXT_PUBLIC_IS_DASHBOARD_USERS_DISABLED=false
19 NEXT_PUBLIC_EXCLUDED_DASHBOARD_STATS=
20 NEXT_PUBLIC_EXCLUDED_LIBRARIES=
21 NEXT_PUBLIC_STATISTICS_START_DATE=2018-01-01

Screenshots

image

Logs

⨯ Error: 'sharp' is required to be installed in standalone mode for the image optimization to function correctly. Read more at: https://nextjs.org/docs/messages/sharp-missing-in-production
TypeError: Cannot read properties of undefined (reading 'id')
    at /app/.next/server/app/rewind/page.js:1:36458
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Promise.all (index 2)
    at async o (/app/.next/server/app/rewind/page.js:1:36246)
    at async m (/app/.next/server/app/rewind/page.js:1:32508)
    at async Promise.all (index 0)
    at async g (/app/.next/server/app/rewind/page.js:1:33471)

On the last run this appended to the error:

[Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.] {
digest: '3846803662'

Platform

desktop

Device

Desktop

Operating System

Ubuntu 22.04

Browser and version

Firefox 121.0 Chrome 120.0.6099.200

Additional context

No response

@EricHupp Looks like there's actually 2 errors going on here at once. Could you please try to alter your .env as follows:

NEXT_PUBLIC_OVERSEERR_URL=http://192.168.1.99:5055
PLEX_HOSTNAME=localhost

It might also help to remove any existing images/containers for plex-rewind and the re-running
docker compose up --build -d again.

ran
docker stop plex-rewind

docker remove plex-rewind

I reset the .env to this

1 NODE_ENV=production
2
3 NEXT_PUBLIC_TAUTULLI_URL=http://192.168.1.99:8181
4 TAUTULLI_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxx
5 NEXT_PUBLIC_OVERSEERR_URL=
6 OVERSEERR_API_KEY=
7 TMDB_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
8 PLEX_HOSTNAME=localhost
9 PLEX_PORT=32400
10
11 NEXT_PUBLIC_SITE_URL=http://localhost:8383
12 NEXTAUTH_URL=http://localhost:8383
13 NEXTAUTH_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
14
15 NEXT_PUBLIC_GOOGLE_ANALYTICS_ID=
16 NEXT_PUBLIC_IS_REWIND_DISABLED=false
17 NEXT_PUBLIC_IS_DASHBOARD_DISABLED=false
18 NEXT_PUBLIC_IS_DASHBOARD_USERS_DISABLED=false
19 NEXT_PUBLIC_EXCLUDED_DASHBOARD_STATS=
20 NEXT_PUBLIC_EXCLUDED_LIBRARIES=
21 NEXT_PUBLIC_STATISTICS_START_DATE=2018-01-01

xxxxxxxxxxx:/opt/plex-rewind# docker compose up --build -d
[+] Building 125.4s (22/22) FINISHED docker:default
=> [plex-rewind internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.11kB 0.0s
=> [plex-rewind internal] load .dockerignore 0.0s
=> => transferring context: 113B 0.0s
=> [plex-rewind internal] load metadata for docker.io/library/node:18-alpine 0.8s
=> [plex-rewind base 1/2] FROM docker.io/library/node:18-alpine@sha256:b1a0356f7d6b86c958a06 0.0s
=> [plex-rewind internal] load build context 0.0s
=> => transferring context: 18.90kB 0.0s
=> CACHED [plex-rewind base 2/2] RUN npm install -g pnpm 0.0s
=> CACHED [plex-rewind builder 1/4] WORKDIR /app 0.0s
=> CACHED [plex-rewind deps 1/4] RUN apk add --no-cache libc6-compat 0.0s
=> CACHED [plex-rewind deps 2/4] WORKDIR /app 0.0s
=> CACHED [plex-rewind deps 3/4] COPY package.json yarn.lock* package-lock.json* pnpm-lock.y 0.0s
=> CACHED [plex-rewind deps 4/4] RUN if [ -f yarn.lock ]; then yarn --frozen-lockfile; e 0.0s
=> CACHED [plex-rewind builder 2/4] COPY --from=deps /app/node_modules ./node_modules 0.0s
=> [plex-rewind builder 3/4] COPY . . 0.1s
=> [plex-rewind builder 4/4] RUN pnpm build 112.7s
=> CACHED [plex-rewind runner 2/8] RUN addgroup --system --gid 1001 nodejs 0.0s
=> CACHED [plex-rewind runner 3/8] RUN adduser --system --uid 1001 nextjs 0.0s
=> [plex-rewind runner 4/8] COPY --from=builder /app/public ./public 0.1s
=> [plex-rewind runner 5/8] RUN mkdir .next 1.6s
=> [plex-rewind runner 6/8] RUN chown nextjs:nodejs .next 0.6s
=> [plex-rewind runner 7/8] COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone 2.6s
=> [plex-rewind runner 8/8] COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.n 0.2s
=> [plex-rewind] exporting to image 0.6s
=> => exporting layers 0.6s
=> => writing image sha256:f2ecae222353bd0f7960128347997f7b6e6b7d6736d3d9561b58b6d2ae18d790 0.0s
=> => naming to docker.io/library/plex-rewind-plex-rewind 0.0s
[+] Running 1/1
✔ Container plex-rewind Started

It connects and runs Plex auth so I know it's connecting to Plex.

xxxxxxxxx:~# docker logs -f plex-rewind
▲ Next.js 14.0.4

✓ Ready in 148ms
⨯ Error: 'sharp' is required to be installed in standalone mode for the image optimization to function correctly. Read more at: https://nextjs.org/docs/messages/sharp-missing-in-production
TypeError: Cannot read properties of undefined (reading 'id')
at /app/.next/server/app/rewind/page.js:1:33539
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 2)
at async o (/app/.next/server/app/rewind/page.js:1:33327)
at async p (/app/.next/server/app/rewind/page.js:1:30690)
at async Promise.all (index 0)
at async w (/app/.next/server/app/rewind/page.js:1:31414)

Still getting the same error

@EricH9958 The sharp error should be fixed in 1.8.7. Please try updating and let me know how it works.
However, I'm guessing that you will still get the same error, because while sharp was in fact giving an error, the more important part is this: TypeError: Cannot read properties of undefined (reading 'id'). Since it's coming from the /rewind page, it looks like it's having trouble reading your user id.

If you still get the same error, you can try 2 things:

  1. Use the "sign out" on the homepage to sign out of your Plex account, then log back in again and see if that helps.
  2. Do a hard refresh to make sure any requests aren't being too aggressively cached. You can do this with cmd + shift + R on mac or ctrl + f5 (or reload button) on windows.

I did both sign out and refresh and oddly enough it works on my sub accounts for my plex home and those work. Just not on my main admin home account. I will wait on the next release and see if that works.

Hey there, wanted to chime in that I too am having the exact same error messages with 1.8.7 as well with docker install.

plex-rewind | ▲ Next.js 14.0.4
plex-rewind | - Local: http://localhost:8383
plex-rewind | - Network: http://0.0.0.0:8383
plex-rewind |
plex-rewind | ✓ Ready in 172ms
plex-rewind | TypeError: Cannot read properties of undefined (reading 'id')
plex-rewind | at /app/.next/server/app/rewind/page.js:1:36525
plex-rewind | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
plex-rewind | at async Promise.all (index 1)
plex-rewind | at async o (/app/.next/server/app/rewind/page.js:1:36313)
plex-rewind | at async m (/app/.next/server/app/rewind/page.js:1:32478)
plex-rewind | at async Promise.all (index 0)
plex-rewind | at async g (/app/.next/server/app/rewind/page.js:1:33518)
plex-rewind | TypeError: Cannot read properties of undefined (reading 'id')
plex-rewind | at /app/.next/server/app/rewind/page.js:1:36525
plex-rewind | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
plex-rewind | at async Promise.all (index 1)
plex-rewind | at async o (/app/.next/server/app/rewind/page.js:1:36313)
plex-rewind | at async m (/app/.next/server/app/rewind/page.js:1:32478)
plex-rewind | at async Promise.all (index 0)
plex-rewind | at async g (/app/.next/server/app/rewind/page.js:1:33518)

I took the suggestions here and logged out and logged back in with no change, same error when attempting to go to rewind. I tried in a private tab and logged in again and this time the error message was different:

plex-rewind | Error fetching from Tautulli API. The query was 'get_history'.
plex-rewind | TypeError: fetch failed
plex-rewind | at Object.fetch (node:internal/deps/undici/undici:11730:11)
plex-rewind | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
plex-rewind | cause: Error: connect ECONNRESET 192.168.4.201:8181
plex-rewind | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
plex-rewind | at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:128:17) {
plex-rewind | errno: -104,
plex-rewind | code: 'ECONNRESET',
plex-rewind | syscall: 'connect',
plex-rewind | address: '192.168.4.201',
plex-rewind | port: 8181
plex-rewind | }
plex-rewind | }
plex-rewind | TypeError: fetch failed
plex-rewind | at Object.fetch (node:internal/deps/undici/undici:11730:11)
plex-rewind | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
plex-rewind | cause: Error: connect ECONNRESET 192.168.4.201:8181
plex-rewind | at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)
plex-rewind | at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:128:17) {
plex-rewind | errno: -104,
plex-rewind | code: 'ECONNRESET',
plex-rewind | syscall: 'connect',
plex-rewind | address: '192.168.4.201',
plex-rewind | port: 8181
plex-rewind | }
plex-rewind | }

And lastly I tried on another account rather than the main account like Eric attempted and error was same as above.

@SiskoUrso Thanks for reporting and the detailed logs.

@EricH9958 and @SiskoUrso are the errors only appearing in /rewind or also /dashboard?

If you can, please help me debug the issue further:

  1. Get the debug/missing-user-id branch. I have added additional debugging steps there to help troubleshoot. Let me know if you require more information on how to clone or download branches.
  2. Set up and start the app as before.
  3. Log out and back in again, if you were already logged in.
  4. Click "Start Rewind"
  5. Observe Docker logs and if the error persists, paste them here. Please be careful not to expose any sensitive information.

@SiskoUrso Thanks for reporting and the detailed logs.

@EricH9958 and @SiskoUrso are the errors only appearing in /rewind or also /dashboard?

Happens on rewind, the dashboard works but missing images.

I will take those steps this evening after work and post the results.

If you can, please help me debug the issue further:

1. Get the [debug/missing-user-id](https://github.com/RaunoT/plex-rewind/tree/debug/missing-user-id) branch. I have added additional debugging steps there to help troubleshoot. Let me know if you require more information on how to clone or download branches.

2. Set up and start the app as before.

3. Log out and back in again, if you were already logged in.

4. Click "Start Rewind"

5. Observe Docker logs and if the error persists, paste them here. Please be careful not to expose any sensitive information.

Ok I was able to pull the requested build and built the image and ran it and opened a new private tab in firefox, logged into my main account and was still getting an error:

plex-rewind | ▲ Next.js 14.0.4
plex-rewind | - Local: http://localhost:8383
plex-rewind | - Network: http://0.0.0.0:8383
plex-rewind |
plex-rewind | ✓ Ready in 186ms
plex-rewind | User data fetched from Plex: {
plex-rewind | id: 'xxxxxxxx',
plex-rewind | name: 'siskourso',
plex-rewind | email: 'xxxxxxx@gmail.com',
plex-rewind | image: 'https://plex.tv/users/xxxxxxxxx/avatar?c=1705015775'
plex-rewind | }
plex-rewind | Your session is: {
plex-rewind | user: {
plex-rewind | name: 'siskourso',
plex-rewind | email: 'xxxxxxxx@gmail.com',
plex-rewind | image: 'https://plex.tv/users/xxxxxxxxxx/avatar?c=1705015775',
plex-rewind | id: 'xxxxxxx'
plex-rewind | }
plex-rewind | }
plex-rewind | Your user data is: {
plex-rewind | name: 'siskourso',
plex-rewind | email: 'xxxxxxxx@gmail.com',
plex-rewind | image: 'https://plex.tv/users/xxxxxxxxxxx/avatar?c=1705015775',
plex-rewind | id: 'xxxxxxxx'
plex-rewind | }
plex-rewind | You're not a managed user!
plex-rewind | This is your user obj after managed user checks: {
plex-rewind | name: 'siskourso',
plex-rewind | email: 'xxxxxxxx@gmail.com',
plex-rewind | image: 'https://plex.tv/users/xxxxxxxx/avatar?c=1705015775',
plex-rewind | id: 'xxxxxxx'
plex-rewind | }
plex-rewind | TypeError: Cannot read properties of undefined (reading 'id')
plex-rewind | at /app/.next/server/app/rewind/page.js:1:36915
plex-rewind | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
plex-rewind | at async Promise.all (index 1)
plex-rewind | at async o (/app/.next/server/app/rewind/page.js:1:36703)
plex-rewind | at async m (/app/.next/server/app/rewind/page.js:1:32478)
plex-rewind | at async Promise.all (index 0)
plex-rewind | at async g (/app/.next/server/app/rewind/page.js:1:33862)

I scrubbed the email, user number in image link, and the id number. Let me know if i scrubbed to much.

@SiskoUrso Thanks! The scrubbing is fine, can you please confirm if the ID is the same in all the logs?

Yes the ID's were all the same.

Hello again 👋

I've just published a 2.0.0 version of plex-rewind.
Since this issue deals with parts of the code that have been completely refactored, I will close this issue for now and suggest you attempt updating.

If you still run into any issues, feel free to open a new ticket.