Skip to content

Incorrect type in Zod schema causing issues for /status/sessions endpoint #37

@DominicFichera

Description

@DominicFichera

id?: number | undefined;

A number of the types in the Zod schema don't match the actual response provided by the Plex API response to the /status/sessions endpoint, and as a result, Zod is throwing an error and not returning response.

Currently running Plex version: 4.147.1

Full URL: http://127.0.0.1:32400/status/sessions

  const plexAPI = new PlexAPI({
    token: "xxxxxxxx",
    accepts: Accepts.ApplicationJson,
    clientIdentifier: "xxxxxxx",
    serverURL: "http://127.0.0.1:32400",
  });
  plexAPI.status.listSessions({}).then((res) => console.log(res));
{
    "code": "invalid_type",
    "expected": "number",
    "received": "string",
    "path": [
      "object",
      "MediaContainer",
      "Metadata",
      0,
      "Director",
      0,
      "id"
    ],
    "message": "Expected number, received string"
  }
{
    "code": "invalid_type",
    "expected": "boolean",
    "received": "string",
    "path": [
      "object",
      "MediaContainer",
      "Metadata",
      0,
      "Media",
      0,
      "hasVoiceActivity"
    ],
    "message": "Expected boolean, received string"
  }
Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions