Skip to content

Attempting to run vercel.teams.getTeams results in a Zod error #95

@dantman

Description

@dantman

Attempting to run vercel.teams.getTeams (I used the npx tsx repl) results in a Zod error.

const { Vercel } = await import('@vercel/sdk');
const vercel = new Vercel({bearerToken: '<insert token here>'});
await vercel.teams.getTeams({ limit: 20 });
Uncaught SDKValidationError: Response validation failed: [
  {
    "code": "invalid_union",
    "unionErrors": [
      {
        "issues": [
          {
            "code": "invalid_type",
            "expected": "object",
            "received": "undefined",
            "path": [
              "teams",
              0,
              "data"
            ],
            "message": "Required"
          }
        ],
        "name": "ZodError"
      },
      {
        "issues": [
          {
            "code": "invalid_type",
            "expected": "boolean",
            "received": "undefined",
            "path": [
              "teams",
              0,
              "limited"
            ],
            "message": "Required"
          },
          {
            "code": "invalid_type",
            "expected": "array",
            "received": "undefined",
            "path": [
              "teams",
              0,
              "limitedBy"
            ],
            "message": "Required"
          },
          {
            "code": "invalid_type",
            "expected": "number",
            "received": "undefined",
            "path": [
              "teams",
              0,
              "membership",
              "confirmedAt"
            ],
            "message": "Required"
          }
        ],
        "name": "ZodError"
      }
    ],
    "path": [
      "teams",
      0
    ],
    "message": "Invalid input"
  }
]
    at safeParse (/home/user/path/to/workspace/node_modules/@vercel/sdk/src/lib/schemas.ts:49:16)
    at matchFunc (/home/user/path/to/workspace/node_modules/@vercel/sdk/src/lib/matchers.ts:295:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  cause: ZodError: [
    {
      "code": "invalid_union",
      "unionErrors": [
        {
          "issues": [
            {
              "code": "invalid_type",
              "expected": "object",
              "received": "undefined",
              "path": [
                "teams",
                0,
                "data"
              ],
              "message": "Required"
            }
          ],
          "name": "ZodError"
        },
        {
          "issues": [
            {
              "code": "invalid_type",
              "expected": "boolean",
              "received": "undefined",
              "path": [
                "teams",
                0,
                "limited"
              ],
              "message": "Required"
            },
            {
              "code": "invalid_type",
              "expected": "array",
              "received": "undefined",
              "path": [
                "teams",
                0,
                "limitedBy"
              ],
              "message": "Required"
            },
            {
              "code": "invalid_type",
              "expected": "number",
              "received": "undefined",
              "path": [
                "teams",
                0,
                "membership",
                "confirmedAt"
              ],
              "message": "Required"
            }
          ],
          "name": "ZodError"
        }
      ],
      "path": [
        "teams",
        0
      ],
      "message": "Invalid input"
    }
  ]
      at get error (file:///home/user/path/to/workspace/node_modules/zod/dist/esm/v3/types.js:39:31)
      at ZodObject.parse (file:///home/user/path/to/workspace/node_modules/zod/dist/esm/v3/types.js:114:22)
      at <anonymous> (/home/user/path/to/workspace/node_modules/@vercel/sdk/src/lib/matchers.ts:297:42)
      at safeParse (/home/user/path/to/workspace/node_modules/@vercel/sdk/src/lib/schemas.ts:47:15)
      at matchFunc (/home/user/path/to/workspace/node_modules/@vercel/sdk/src/lib/matchers.ts:295:9)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      at async $do (/home/user/path/to/workspace/node_modules/@vercel/sdk/src/funcs/teamsGetTeams.ts:162:20) {
    issues: [ [Object] ],
    addIssue: [Function (anonymous)],
    addIssues: [Function (anonymous)],
    errors: [ [Object] ]
  },
  rawValue: {
    teams: [ [Object] ],
    pagination: { count: 1, next: null, prev: 1711551702465 }
  },
  rawMessage: 'Response validation failed'
}

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