Skip to content

postUsersSignInData - SDKValidationError: Response validation failed #33

@lorenalexm

Description

@lorenalexm

When attempting to log a user in with the postUsersSignInData function, I am getting back a SDKValidationError: Response validation failed. The full error message is this:

SDKValidationError: Response validation failed: [
  {
    "received": 2,
    "code": "invalid_enum_value",
    "options": [
      0,
      1
    ],
    "path": [
      "UserPlexAccount",
      "profile",
      "autoSelectSubtitle"
    ],
    "message": "Invalid enum value. Expected 0 | 1, received '2'"
  }
]
    at safeParse (/Users/lorenalexm/Projects/whatToWatch/node_modules/@lukehagar/plexjs/lib/schemas.js:37:33)
    at matchFunc (/Users/lorenalexm/Projects/whatToWatch/node_modules/@lukehagar/plexjs/lib/matchers.js:158:44)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async $do (/Users/lorenalexm/Projects/whatToWatch/node_modules/@lukehagar/plexjs/funcs/authenticationPostUsersSignInData.js:124:22) {
  cause: ZodError: [
    {
      "received": 2,
      "code": "invalid_enum_value",
      "options": [
        0,
        1
      ],
      "path": [
        "UserPlexAccount",
        "profile",
        "autoSelectSubtitle"
      ],
      "message": "Invalid enum value. Expected 0 | 1, received '2'"
    }
  ]
      at get error [as error] (/Users/lorenalexm/Projects/whatToWatch/node_modules/zod/lib/types.js:55:31)
      at ZodEffects.parse (/Users/lorenalexm/Projects/whatToWatch/node_modules/zod/lib/types.js:131:22)
      at /Users/lorenalexm/Projects/whatToWatch/node_modules/@lukehagar/plexjs/lib/matchers.js:158:73
      at safeParse (/Users/lorenalexm/Projects/whatToWatch/node_modules/@lukehagar/plexjs/lib/schemas.js:34:32)
      at matchFunc (/Users/lorenalexm/Projects/whatToWatch/node_modules/@lukehagar/plexjs/lib/matchers.js:158:44)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async $do (/Users/lorenalexm/Projects/whatToWatch/node_modules/@lukehagar/plexjs/funcs/authenticationPostUsersSignInData.js:124:22)

What's interesting though, is it appears to have completed the request as the logs show a UserPlexAccount object that is populated with information as displayed in the console. I've redacted a fair bit of information, but you can see the rest of the response here:

{
    issues: [ [Object] ],
    addIssue: [Function (anonymous)],
    addIssues: [Function (anonymous)],
    errors: [ [Object] ]
  },
  rawValue: {
    ContentType: 'application/json',
    StatusCode: 201,
    RawResponse: Response {
      [Symbol(realm)]: null,
      [Symbol(state)]: [Object],
      [Symbol(headers)]: [HeadersList]
    },
    Headers: {},
    UserPlexAccount: {
      id: REDACTED,
      uuid: 'REDACTED',
      username: 'REDACTED',
      title: 'REDACTED',
      email: 'REDACTED',
      friendlyName: '',
      locale: null,
      confirmed: false,
      joinedAt: REDACTED,
      emailOnlyAuth: false,
      hasPassword: true,
      protected: true,
      thumb: 'REDACTED',
      authToken: 'REDACTED',
      mailingListStatus: 'unsubscribed',
      mailingListActive: false,
      scrobbleTypes: '',
      country: 'US',
      pin: 'REDACTED',
      subscription: [Object],
      subscriptionDescription: 'Monthly Plex Pass',
      restricted: false,
      anonymous: false,
      home: true,
      guest: false,
      homeSize: 9,
      homeAdmin: true,
      maxHomeSize: 15,
      rememberExpiresAt: REDACTED,
      profile: [Object],
      entitlements: [Array],
      roles: [Array],
      subscriptions: [Array],
      pastSubscriptions: [],
      trials: [],
      services: [Array],
      adsConsent: null,
      adsConsentSetAt: null,
      adsConsentReminderAt: null,
      experimentalFeatures: false,
      twoFactorEnabled: false,
      backupCodesCreated: false,
      attributionPartner: null
    }
  },
  rawMessage: 'Response validation failed'
}

I've tried looking through the source of the library to see if I could track down exactly where and which enum is failing to parse; but in truth I am a bit over my head and slightly drowning in formation.

I am currently on version 0.36.0 of the library, so should be the most up to date. I am using JavaScript and Node while running on macOS.

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