-
-
Notifications
You must be signed in to change notification settings - Fork 380
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
NestJS with Fastify - no overload matches this call #578
Comments
Can you try this package https://github.com/DennisSnijder/nestjs-bull-board-example |
@felixmosh awesome! That worked, thanks. However, the middleware does not seem to work, not sure why. I tried applying this middleware: /* eslint-disable @typescript-eslint/no-floating-promises */
import { Injectable, NestMiddleware } from '@nestjs/common';
import { FastifyReply, FastifyRequest } from 'fastify';
@Injectable()
export class BasicAuthMiddleware implements NestMiddleware {
use(req: FastifyRequest, res: FastifyReply, next: () => void) {
const authHeader = req.headers.authorization;
if (!authHeader || !authHeader.startsWith('Basic ')) {
res.statusCode = 401;
res.header('WWW-Authenticate', 'Basic realm="Restricted"');
res.send('Unauthorized');
return;
}
const credentials = Buffer.from(authHeader.split(' ')[1], 'base64').toString().split(':');
const username = credentials[0];
const password = credentials[1];
// Replace this with your own authentication logic
const isValid = username === 'admin' && password === 'password';
if (!isValid) {
res.statusCode = 401;
res.send('Unauthorized');
return;
}
next();
}
} Using: BullBoardModule.forRoot({
route: '/queues',
middleware: [BasicAuthMiddleware],
adapter: FastifyAdapter,
}), |
Thanks for the help! Created a dedicated issue for it here: DennisSnijder/nestjs-bull-board#1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just stumbled upon #569 and wanted to integrate with a NestJS application, however, we're getting the following error:
This is our global queue module:
The text was updated successfully, but these errors were encountered: