NestJs registering Fastify/Cookie plugin

1k views Asked by At

Hi i am trying to register the @fastify/cookie plugin to my nestjs backend but i have an error and i don't know why because in previous code i was doing the same thinks and was working , i don't know if versions changed or if there is a new way of registering plugins with nestJs -> Fastify

here is my code

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import {
FastifyAdapter,
NestFastifyApplication,
} from '@nestjs/platform-fastify';
import fastifyCookie from '@fastify/cookie';

async function bootstrap() {
const app = await NestFactory.create<NestFastifyApplication>(
  AppModule,
  new FastifyAdapter(),
);

await app.register(fastifyCookie, { secret: '' });
await app.listen(3005);
}

bootstrap();

and i am getting

Argument of type 'FastifyCookie' is not assignable to parameter of type 'FastifyPluginCallback<FastifyCookieOptions, RawServerDefault, FastifyTypeProviderDefault, FastifyBaseLogger> | FastifyPluginAsync<...> | Promise<...> | Promise<...>'

here are the versions i am using

  • "@nestjs/core": "^9.3.9"
  • "@nestjs/platform-fastify": "^9.2.0"
  • "@fastify/cookie": "^8.3.0",
0

There are 0 answers