felixmosh / bull-board

🎯 Queue background jobs inspector
MIT License
2.32k stars 362 forks source link

Job results do not appear when using express 5 #404

Open CJEnright opened 2 years ago

CJEnright commented 2 years ago

When using express 5 job results can no longer be seen:

Screen Shot 2022-04-24 at 22 03 40

I've tracked this down to a breaking change in express 5 where req.query has become a getter, whereas in express 4 it was set as part of a middleware function:

This leads to req.query being undefined in libraries that pull in express 4 (like bull-board). For bull-board this causes no active queue to be selected, and so no jobs for that queue are returned. I think this could be fixed if we were to set the express dependency to >=4.17.3.

In the meantime, this can be used as a somewhat hacky workaround:

router.use(
    "/queues",
    (req: Request, res: Response, next: NextFunction) => {
        const query = req.query;
        // Set query as a property on req instead of as a getter for backwards
        // compatibility with express 4
        Object.defineProperty(req, "query", { get: () => query });
        next();
    },
    serverAdapter.getRouter()
);
felixmosh commented 2 years ago

Bull-board is not supports express v5 since it is not an official version yet.

It is easy to add, but I'm not sure about the demand of it.

Let's vote on this issue, if we will pass 30 likes, I will add it.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.