Questions tagged [nestjs-fastify]
36 questions
5
votes
1 answer
End-to-end testing NestJS with Fastify: "@nestjs/platform-express" package is missing" error
I have fresh NestJS application using Fastify. When trying to npm run test:e2e I got the following error:
[Nest] 14894 - 11/19/2021, 10:29:10 PM [ExceptionHandler] The "@nestjs/platform-express" package is missing. Please, make sure to install…

Daniel Kucal
- 8,684
- 6
- 39
- 64
5
votes
3 answers
NestJS Fastify Authentication
So I replaced ExpressJS with Fastify, but my problem is Nest-Passport doesn't support fastify, do we have an alternative for Nest-Passport? or any solutions on how to secure RestAPI in nestJS using a token?

Dan
- 69
- 2
- 8
4
votes
0 answers
How to set config for Fastify route config when using NestJS
There is an option to set route config in Fastify like:
https://www.fastify.io/docs/latest/Routes/#config
fastify.get('/en', { config: { output: 'hello world!' } }, handler)
but is there an option to set config when using NestJS with Fastify?
//…

mardok
- 2,135
- 2
- 23
- 37
4
votes
1 answer
How to get/set request/response header in middelware [Nest Fastify]?
How to inject a request header in NestJS using Fastify.
import { FastifyRequest, FastifyReply } from 'fastify'; // fastify types are not valid
@Injectable()
export class TracingMiddleware implements NestMiddleware {
use(req: any, res: any, next:…

Daniel Delgado
- 4,813
- 5
- 40
- 48
3
votes
2 answers
How to send response from middleware created in a Nest fastify server?
I've created a NestJs project with Fastify, and have created a middleware for it, but I can't figure out how to send a response to the client, similar to how we could do in express, any help would be appreciated, thanks!, here's my middleware…

Faaiz ali Khan
- 37
- 2
- 8
2
votes
0 answers
NestJs registering Fastify/Cookie plugin
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…

Alexandre29
- 57
- 2
- 8
2
votes
1 answer
Nestjs crashes when throwing error after update to v9
I have updated my application from Nest.js v8 to Nest.js v9 and now the application exits every time an error is thrown.
Previously, an HTTPException was simply returned. But now every time the server terminates and I get this error:
`TypeError:…

Daniel Mair
- 23
- 4
2
votes
1 answer
How do I serve static files in NestJS using fastify?
How does one serve static files in NestJS using fastify? I can't seem to find any recent examples of setting this up properly. I have my main.ts set up like this:
main.ts
// This must be the first thing imported in the app
import…

emilyw26
- 113
- 1
- 7
2
votes
1 answer
NestJS Fastify JWKS Validation
I am using the Fastify Adapter in my NestJS application and would like to add some logic to do JWKS validation, similar to the passport example on the Auth0 website.
// src/authz/jwt.strategy.ts
import { Injectable } from '@nestjs/common';
import…

mh377
- 1,656
- 5
- 22
- 41
2
votes
1 answer
Increase body limit with nestjs & fastify
My main.ts looks like this :
import { NestFactory } from '@nestjs/core';
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
import { Logger } from 'nestjs-pino';
import { processRequest } from 'graphql-upload';
import…

Valentine
- 315
- 1
- 4
- 15
2
votes
1 answer
How to configure rate-limit with fastify-adapter in nest js
I Just started implementing API's Nest js and I am using Fastify adapter.
I need help to configure Rate limit using FastifyAdapter in Nest JS.
async function bootstrap() {
const app = await NestFactory.create(
…

Gowtham Raj
- 103
- 2
- 13
1
vote
1 answer
Disable NestInterceptor auto stringify
I'm using the following NestInterceptor to add code, message and data to final response:
export class HttpResponseInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, next: CallHandler): Observable {
return…

Hhry
- 823
- 1
- 8
- 19
1
vote
1 answer
NestJS: How can I access controller function response using a custom decorator?
This is my decorator
import { createParamDecorator, ExecutionContext } from "@nestjs/common";
export const CacheData = createParamDecorator(
(data: any, ctx: ExecutionContext) => {
const request = ctx.switchToHttp().getRequest();
…

Mahmoud Hadad
- 160
- 3
- 10
1
vote
1 answer
NestJS Kafka Microservice with REST Endpoints
I am new to NestJS and was wondering if its possible to have a NestJS Kafka micro-service with REST Endpoints as well (ideally using Fastify).
I have found the following configuration for both Kafka and for Fastify but it seems like you can only…

mh377
- 1,656
- 5
- 22
- 41
1
vote
1 answer
How to solve nestjs fastify error TypeError: response.status(...).json is not a function
TypeError: response.status(...).json is not a function
at HttpExceptionFilter.catch (/home/muhammedali/Documents/100haryt_v2/src/common/http/http-exception.filter.ts:23:29)
at ExceptionsHandler.invokeCustomFilters…

Muha_king
- 11
- 3