Hey all, I've been trying to debug why CORS and switching to HttpHostArgument no longer work with the fastify adapter. Here's my code:
const app = await NestFactory.create<NestFastifyApplication>(
AppModule,
new FastifyAdapter({
// This makes it parse just like ExpressJS and support JSON API spec
querystringParser: (str: string) => qs.parse(str),
}),
);
app.enableCors();
For some reason, I'm now getting CORS errors like it's not even applying anything.
Second, in my Global Exception filter, I used to be able to handle exceptions and respond using the FastifyReply. I'm now getting a ServerResponse<IncomingMessage> object for some reason:
@Catch()
export class GlobalExceptionFilter implements ExceptionFilter {
catch(exception, host: ArgumentsHost): void {
const context = host.switchToHttp();
const response = context.getResponse<FastifyReply>();
^-- Response used to be a FastifyReply instance. Now it's a ServerResponse<IncomingMessage>?
Any ideas what could have happened? I haven't changed anything in my main.ts only added more modules/controllers/services?
[System Information]
OS Version : Linux 5.11
NodeJS Version : v18.16.0
NPM Version : 9.5.1
[Nest CLI]
Nest CLI Version : 10.1.17
[Nest Platform Information]
platform-fastify version : 10.2.4
schematics version : 10.0.2
terminus version : 10.0.1
swagger version : 7.1.10
testing version : 10.2.4
common version : 10.2.4
config version : 3.0.1
core version : 10.2.4
cli version : 10.1.17