Skip to content

feat: customize lastEventId input field name #6936

Open

Description

@IlyaSemenov

Describe the feature you'd like to request

Currently lastEventId, an input schema field, is hardcoded through the project:

return {
...(input ?? {}),
lastEventId,
};

This is not clear from the documentation that this name is hardcoded to have special meaning and not just a generic example.

I propose to make this a configurable setting per subscription. Examples where it makes sense:

  1. Most of the time, the subscriptions return objects of a particular type, and the code becomes more clear if the input field could be named lastPostId, lastMessageId, etc. (both server and client side!)
  2. I have a project where the entire naming is snake_case, and lastEventId looks alien in the input schema.

Describe the solution you'd like to see

subscription() could have an overload accepting options, such as:

const subscribeToMessages = procedure
  .input(v.object({
    lastMessageId: v.optional(v.pipe(v.string(), v.uuid())),
  }))
  .subscription({ lastEventIdField: "lastMessageId" }, async function* ({
    input: { lastMessageId },
    signal,
  }) {
    // Implementation

Describe alternate solutions

At the very least, it should be very clearly documented that the field must be named exactly lastEventId and this is not just an example. Currently, the documentation only mentions that "this is part of the EventSource-spec" but the said spec field is Last-Event-ID (an HTTP header), which doesn't really imply that lastEventId is also hardcoded (because unlike the standard HTTP header, there is no real reason to do so).

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR implementing this feature!

Activity

  1. dkrieger commented on Oct 23, 2025

    @dkrieger

    I'd like to suggest that whether or not this feature request is ultimately accepted, the docs should be updated today to clarify this situation

  2. KATT commented on Nov 2, 2026

    @KATT
    Member

    🤖 In v12, lastEventId isn't an input field anymore: the resolver gets it as an option, so your input can use any names. https://v12.trpc.io/v12/docs/subscriptions/overview#resuming. v12 isn't released yet and there's no ETA.

  3. added
    next-major/definite
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    next-major/definite

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions