fix: send queue job payloads to the admin page as objects

BullMQ's asJSON() stringifies data, failedReason, stacktrace and
returnvalue. The Queues page reads them as objects, so payload repo IDs
never showed, failure reasons kept their JSON quotes, and a stack trace
rendered one block per character.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
tdurieuxandClaude Opus 5.5 committed 2026-10-08 14:46:01 +02:00
1 parent fd1bce74b4
commit cfd7b73de4
2 files changed
+42 -1

No files matched your search

+10 -1
View File
@@ -381,7 +381,16 @@ router.get("/queues", dashboardCache, async (req, res) => {
...QUEUE_STATES.map(async (state) => {
const jobs = await targetQueue.getJobs([state], 0, 199);
return jobs.map((j) => {
const json: Record<string, unknown> = { ...j.asJSON(), _state: state };
// asJSON() serializes these fields to strings; the dashboard needs
// the objects (payload repoId, stack lines, failure reason).
const json: Record<string, unknown> = {
...j.asJSON(),
data: j.data,
failedReason: j.failedReason,
stacktrace: j.stacktrace,
returnvalue: j.returnvalue,
_state: state,
};
if (state === "delayed" && j.delay > 0) {
json.delayUntil = j.timestamp + j.delay;
}