-
Notifications
You must be signed in to change notification settings - Fork 0
Apply middleware using Fastify #1
Comments
This worked: BullBoardModule.forRoot({
- route: '/queues',
+ route: '/queues/',
middleware: [BasicAuthMiddleware],
adapter: FastifyAdapter,
}), |
Oh, while that will have the middleware register, it will cause a 404. Also, if you access |
This is a nasty workaround: consumer.apply(BasicAuthMiddleware).forRoutes(
{
path: 'queues(.*)',
method: RequestMethod.ALL,
},
{
path: 'queues/',
method: RequestMethod.ALL,
},
{
path: 'queues',
method: RequestMethod.ALL,
},
{
path: '/queues/',
method: RequestMethod.ALL,
},
{
path: '(.*)queues(.*)',
method: RequestMethod.ALL,
},
); |
Hi @simplenotezy, thanks for the report and the research/potential fix you already pointed out! I already tested out some |
Totally agree, it was rather frustrating trying to do something so simple, yet find it so hard. Not even ChatGPT with 100 trillion parameters managed to solve it. |
Okay, I'm trying to debug why the route isn't matching, but oddly enough some of the routes you provide require some authentication. Soooo.... what I found is the following. When i log Might also explain why I'm able to to enter the dashboard on I posted a question on the NestJS Discord regarding this. Perhaps it's a bug on NestJS side / unclear instructions on how to deal with Fastify and using middlewares. I'll keep you updated! Edit: seems like this is an issue for NestJS.... nestjs/nest#11585 |
Nice! Thanks for the update. Fingers crossed |
Something perhaps unrelated, but I couldn't rename the path to anything but "queues" |
Hmm that's odd, I can't seem to replicate that issue. Do you have an example of your setup? Or a url you're trying to use? |
@simplenotezy nestjs/nest#11718 Fix for the issue described above should be on it's way! 😄 |
Nice! Looking forward |
@simplenotezy it has been merged! when you update Since you're using (or still implementing) this module/library, I want to give you a quick heads up: The creator of bull-board asked me to create a PR to integrate this library into the bull-board monorepo and create a new package which will most likely be called |
Hmm - I upgraded p.s. Sounds great with a dedicated @bull-board/nestjs package! |
If that doesn't fix the problem lemme reopen this issue, I'll take a look into it. About the route, are you using any router other than |
ugh, @simplenotezy sorry for the false hope, seems like the merged PR didn't quite make it into 9.4.3. I think I tested the middleware on a development build where I had a wildcard enabled.... 😓. Let's wait for NestJS to release a new version. |
Ah okay, thanks for the update! 😊 |
@simplenotezy the new Github: https://github.com/felixmosh/bull-board/tree/master/packages/nestjs I'll open this issue on the bull-board github and reference this issue in there. |
The middleware does not seem to work, not sure why. I tried applying this middleware:
Using:
The text was updated successfully, but these errors were encountered: