Skip to content

Jobs List page crushed: AttemptErrors not present in response #347

@spatecon

Description

@spatecon

Trying open http://localhost:8080/jobs?state=completed on non-empty environment after the merge of #344 resulted in JS error and page crush if job list not empty:

react-dom_client.js?v=200b8c56:6264 TypeError: Cannot read properties of undefined (reading 'map')
    at apiAttemptErrorsToAttemptErrors (jobs.ts:113:17)
    at apiJobToJob (jobs.ts:96:11)
    at Array.map (<anonymous>)
    at jobs.ts:231:33

The above error occurred in the <MatchInnerImpl> component.

Seems like errors field is null (omited) in the /jobs api response and leads to error in apiAttemptErrorsToAttemptErrors.

GET http://localhost:8080/api/jobs?limit=20&state=completed

{
    "data": [
        {
            "id": 189614,
            "args": {},
            "attempt": 1,
            "attempted_at": "2025-05-08T11:10:25.46676Z",
            "attempted_by": [
                "perforator-backend-54c5485ffb-x5wqt_2025_05_07T12_09_22_948225"
            ],
            "created_at": "2025-05-08T11:10:25.460947Z",
            "finalized_at": "2025-05-08T11:10:25.471822Z",
            "kind": "job.river.export_metrics",
            "max_attempts": 25,
            "priority": 1,
            "queue": "default",
            "scheduled_at": "2025-05-08T11:10:25.458981Z",
            "state": "completed",
            "tags": []
        },
...
}

Because the struct RiverJobMinimal inhandler_api_endpoint.go:1115 doesn't contain errors and metadata anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions