ParseError with Domain Model Schema in RPC Procedure Success Schema

Trying to use the domain model schema as the RPC procedure success schema throws ParseError when serializing the result on the client:

export class InboxEntry extends Schema.Class<InboxEntry>("InboxEntry")({
    id: InboxEntryId,
    status: InboxEntryStatus,
    content: Schema.NonEmptyTrimmedString,
    createdAt: Schema.DateTimeUtcFromDate,
    updatedAt: Schema.DateTimeUtcFromDate,
}) {}


The RPC definition:

export class GetInboxEntriesRequest extends Rpc.make("GetInboxEntries", {
    stream: true,
    success: InboxEntry,
}) {}


The error:

Error: ParseError: readonly [(InboxEntry (Encoded side) <-> InboxEntry), ...(InboxEntry (Encoded side) <-> InboxEntry)[]] └─ [0] └─ (InboxEntry (Encoded side) <-> InboxEntry) └─ Encoded side transformation failure └─ InboxEntry (Encoded side) └─ ["createdAt"] └─ DateTimeUtcFromDate └─ Encoded side transformation failure └─ Expected a Date to be decoded into a DateTime.Utc, actual "2025-09-16T15:47:58.137Z"


Do I need to create a new schema for the request success? Or should I transform it somehow? The only approach that worked for sure was using Schema.Union(Schema.DateTimeUtc, Schema.DateTimeUtcFromDate).
Was this page helpful?