Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wes1993 opened this issue Oct 9, 2024 · 8 comments

Comments

@wes1993
Copy link

wes1993 commented Oct 9, 2024

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

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser: [e.g. Firefox, Safari]
  • Version: [e.g. 22]

Additional Context

@gareins
Copy link

gareins commented Oct 10, 2024

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
Copy link
Author

wes1993 commented Oct 10, 2024

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
Copy link

gareins commented Oct 10, 2024

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
Copy link
Author

wes1993 commented Oct 10, 2024

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

#2952

But unfortunately only works with new library

@gareins
Copy link

gareins commented Oct 18, 2024

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
Copy link
Author

wes1993 commented Oct 19, 2024

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/[email protected]/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/[email protected]/node_modules/fastify/lib/pluginUtils.js:125:11)
viewtube-1          |     at Object.registerPlugin (/home/app/node_modules/.pnpm/[email protected]/node_modules/fastify/lib/pluginUtils.js:148:16)
viewtube-1          |     at Boot.override (/home/app/node_modules/.pnpm/[email protected]/node_modules/fastify/lib/pluginOverride.js:28:57)
viewtube-1          |     at Boot._loadPlugin (/home/app/node_modules/.pnpm/[email protected]/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

@gareins
Copy link

gareins commented Oct 21, 2024

Ok, I agree with the error, I just don't know why I dont get it. Maybe some difference in logging level. I get

viewtube-main       | [ViewTube] 1      - 10/21/2024, 7:45:34 AM     LOG  Redis connection established
viewtube-main       | Scheduled subscription job to run every 60 minutes                                                                                    viewtube-main       | [ViewTube] 1      - 10/21/2024, 7:45:35 AM     LOG [NestFactory] Starting Nest application...
viewtube-main       | [ViewTube] 1      - 10/21/2024, 7:45:35 AM     LOG [InstanceLoader] MongooseModule dependencies initialized
viewtube-main       | [ViewTube] 1      - 10/21/2024, 7:45:35 AM     LOG [InstanceLoader] JwtModule dependencies initialized
viewtube-main       | [ViewTube] 1      - 10/21/2024, 7:45:35 AM     LOG [InstanceLoader] ConfigHostModule dependencies initialized
viewtube-main       | [ViewTube] 1      - 10/21/2024, 7:45:35 AM     LOG [InstanceLoader] NuxtModule dependencies initialized
viewtube-main       | [ViewTube] 1      - 10/21/2024, 7:45:35 AM     LOG [InstanceLoader] DiscoveryModule dependencies initialized
...

Do you get any messages after the error, or is it fatal and the viewtube container just refuses to continue loading?

@wes1993
Copy link
Author

wes1993 commented Oct 21, 2024

Hello @gareins
Thanks a lot for your reply,
It's fatal and viewtube container refuses to start, but I have solved disabling the lock file and in package.json changing from 12.0.1 to 11.1.1 for fastify helmet.

Best Regards
Stefano

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants