ViewTube / viewtube

▶️ ViewTube: The open source, privacy-conscious way to enjoy your favorite YouTube content. Docs: https://viewtube.wiki, Status: https://uptime.viewtube.io
https://viewtube.io
GNU Affero General Public License v3.0
1.31k stars 75 forks source link

[BUG] FastifyError [Error]: fastify-plugin: @fastify/helmet - expected '5.x' fastify version, '4.28.1' is installed #2991

Open wes1993 opened 1 week ago

wes1993 commented 1 week ago

Describe the Bug

Cannot run the dev and nightly build the error "FastifyError [Error]: fastify-plugin: @fastify/helmet - expected '5.x' fastify version, '4.28.1' is installed" apper as soon as viewtube container start.

Steps to Reproduce the Bug

  1. put dev image in container
  2. run with docker compose

Expected Behaviour

The container should start

Screenshot/Screen recording

Device Info

Additional Context

gareins commented 1 week ago

Just at first glance, the fastify version locked in server/package.json is 4.28.1, however the fastify helmet plugin is locked in same file to 12.0.1. If we look at the code for helmet fastify I found searching online this version really wants 5.x: https://www.npmjs.com/package/@fastify/helmet?activeTab=code

Honestly dont know how to resolve, maybe downgrade the helmet plugin back to what it was before the change to 11.1.1?

wes1993 commented 1 week ago

Hello @gareins, Thanks a lot for your reply, someone exist :-D

But there is a way to update fastify to 5?

The problem behind this i that when I try to play a video an error message appear after some seconds and seems that the only way to resolve is use the beta and add po token

Best Regards Stefano

gareins commented 1 week ago

Hi, I am but just a busy parent trying to get this running. I also had the same errors you opened ( #2988 and #2989 ), I tried to build the docker myself and got a little bit further ( #2968 ) but I dont have the time to actually try running and see this error you posted here...

seems that the only way to resolve is use the beta and add po token

Can you explain, what is this po token?

wes1993 commented 1 week ago

Sure, seems that the only solution to make viewtube working again is using the po toke, you can see here

https://github.com/ViewTube/viewtube/issues/2952

But unfortunately only works with new library

gareins commented 1 day ago

Hi, as I said this is gonna be slow :)

I have the playback working now, with the token and stuff. So the way I do it is I clone my fork (https://github.com/gareins/viewtube.git) into folder "git-repo". Then I set the token values in server/src/common/innertube/innertube.ts. Then in the docker compose file that I use I change the image: mauriceo/viewtube:dev into:

build:
      context: ./git-repo
      dockerfile: Dockerfile

This will build (I did some changes so that the build works, explained in #2968) your own image with the tokens you want. Hope this helps!

wes1993 commented 7 hours ago

Hello @gareins, I have followed your instruction, but I still have the same problem even if I'll compile the image container by myself:

viewtube-1          | [ViewTube] 1      - 10/19/2024, 8:35:42 AM     LOG  Redis connection established
viewtube-1          | Scheduled subscription job to run every 60 minutes
viewtube-1          |
viewtube-1          | /home/app/node_modules/.pnpm/fastify@4.28.1/node_modules/fastify/lib/pluginUtils.js:125
viewtube-1          |     throw new FST_ERR_PLUGIN_VERSION_MISMATCH(meta.name, requiredVersion, this.version)
viewtube-1          |           ^
viewtube-1          | FastifyError [Error]: fastify-plugin: @fastify/helmet - expected '5.x' fastify version, '4.28.1' is installed
viewtube-1          |     at Object.checkVersion (/home/app/node_modules/.pnpm/fastify@4.28.1/node_modules/fastify/lib/pluginUtils.js:125:11)
viewtube-1          |     at Object.registerPlugin (/home/app/node_modules/.pnpm/fastify@4.28.1/node_modules/fastify/lib/pluginUtils.js:148:16)
viewtube-1          |     at Boot.override (/home/app/node_modules/.pnpm/fastify@4.28.1/node_modules/fastify/lib/pluginOverride.js:28:57)
viewtube-1          |     at Boot._loadPlugin (/home/app/node_modules/.pnpm/avvio@8.3.2/node_modules/avvio/boot.js:425:25)
viewtube-1          |     at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
viewtube-1          |   code: 'FST_ERR_PLUGIN_VERSION_MISMATCH',
viewtube-1          |   statusCode: 500
viewtube-1          | }
viewtube-1          |
viewtube-1          | Node.js v20.18.0

I have also changed the package.json to point to 5.0.0 of fastify file and disabled the lockfile during the build and install but seems that still find the 4.28.1 version... :-( do you have some suggestion?

Best Regard Stefano