Skip to content

Node.js SDK: subscriptions.update() rejects trialEnd: 'now' #13606

Description

@stilla

The backend schema (server/polar/subscription/schemas.py, SubscriptionUpdate.trial_end) types trial_end as FutureDatetime | Literal["now"] | None, but the generated Node.js SDK (@polar-sh/sdk, v0.49.0) only types/validates trialEnd as Date | null | undefined (see SubscriptionUpdateBase$outboundSchema in src/models/components/subscriptionupdatebase.ts).

Calling subscriptions.update() with trialEnd: 'now' fails client-side Zod validation with expected date, received string, even though the API accepts 'now' to end a trial immediately. The only workaround is bypassing the SDK with a raw fetch call.

Likely needs a fix to how the trial_end union is exposed in the OpenAPI spec (or a Speakeasy override) so the generated SDK accepts Date | 'now' | null.

Sent by @allison-polar from Polar SDK trialEnd Zod validation bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    polar-teamIssues that will be handled by the core Polar teamtheme:billing

    Type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions