Skip to content

[Bug]: Unexpected API change (new 'BLOCKED' state) breaks backward compatibility and causes runtime Zod errors in older SDK versions #299

Description

@RodrigoTomeES

Recently, our production SaaS application went down without any code changes on our end. This happened because the Vercel API started returning a new state and readyState value (BLOCKED) for deployments.

Because the Vercel SDK uses strict Zod enum validation for the deployment state, our installed version of the SDK threw a runtime exception when parsing the response, effectively breaking our application.

This is the second time an unannounced breaking change in the underlying Vercel API has broken our production environment due to strict validation in the SDK. It is highly frustrating to wake up to a broken product when no deployments or changes were made on our side.

Error Log

Here is the runtime error caused by the library failing to parse the new API response in the method await vercel.deployments.getDeployments({ teamId: teamId, projectId: vercelProjectName });:

[cause]: Error [ZodError]: [
    {
      "code": "invalid_union",
      "unionErrors": [
        // ... omitted some output for brevity
        {
          "issues": [
            {
              "received": "BLOCKED",
              "code": "invalid_enum_value",
              "options": [
                "BUILDING",
                "ERROR",
                "INITIALIZING",
                "QUEUED",
                "READY",
                "CANCELED",
                "DELETED"
              ],
              "path": ["deployments", 5, "state"],
              "message": "Invalid enum value. Expected 'BUILDING' | 'ERROR' | 'INITIALIZING' | 'QUEUED' | 'READY' | 'CANCELED' | 'DELETED', received 'BLOCKED'"
            }
          ],
          "name": "ZodError"
        }
      ],
      "path": ["deployments", 5, "state"],
      "message": "Invalid input"
    },
    // ... same error repeats for "readyState"
]

Expected Behavior

  • APIs should ideally maintain backward compatibility. If a new enum value is added to the API, older SDK versions shouldn't crash entirely. The SDK should handle unknown states gracefully rather than failing strict validation and taking down the consuming application.

  • Breaking API changes should be communicated transparently.

Questions regarding workflow and updates

Since we need to ensure our SaaS remains stable, I would like to ask for guidance on how we should consume this SDK:

  • Communication: Is there a specific mailing list, changelog, or status page where these API changes (like adding new deployment states) are announced before they are deployed? This would allow us to adapt our code in advance.

  • Release Cadence: Are new SDK versions released to support these API changes before the API changes actually go live in production?

  • Recommended Workflow: What is Vercel's recommended workflow to prevent these runtime errors? Are we expected to constantly set up automated jobs to update the Vercel SDK to the latest version to avoid our production app from breaking?

We love using Vercel, but we need a reliable way to interact with the API without the fear of strict validation breaking our app unexpectedly. Thank you for your time and help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions