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.
The backend schema (
server/polar/subscription/schemas.py,SubscriptionUpdate.trial_end) typestrial_endasFutureDatetime | Literal["now"] | None, but the generated Node.js SDK (@polar-sh/sdk, v0.49.0) only types/validatestrialEndasDate | null | undefined(seeSubscriptionUpdateBase$outboundSchemainsrc/models/components/subscriptionupdatebase.ts).Calling
subscriptions.update()withtrialEnd: 'now'fails client-side Zod validation withexpected 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_endunion is exposed in the OpenAPI spec (or a Speakeasy override) so the generated SDK acceptsDate | 'now' | null.Sent by @allison-polar from Polar SDK trialEnd Zod validation bug.