Skip to content

SDK Events Type Mismatch #2250

Closed
Closed

Description

@OliverGilan

Using the Opencode SDK as documented here.

When trying to subscribe to stream of events:

const eventStream = await opencode.event.subscribe();
for await (const event of eventStream) {
  console.log('Event:', event.type, event.properties);
  onEvent(event);
}

I get a type error in my IDE:

Type:
must have a [Symbol.asyncIterator]() method that returns an async iterator.

It's unclear how to actually consume this stream properly

Activity

  1. rekram1-node commented on Aug 26, 2025

    @rekram1-node
    Member

    The sdk isn't being generated properly, looks like it may be a stainless limitation for current subscription: https://www.stainless.com/docs/guides/configure#enterprise

  2. OliverGilan commented on Aug 26, 2025

    @OliverGilan
    Author

    I figured it was that. Didn’t know if the team was paying for that enterprise feature and just misconfigured or wasn’t on that tier.

    Such a funny feature to price gate. I’ll try to create an example helper function that wraps the stream and turns it into an async iterable so we can update the docs to show how to consume the stream effectively

  3. rekram1-node commented on Aug 26, 2025

    @rekram1-node
    Member

    just realized it is generated w/ Hey API which supposedly does support the stream so this should be fixable

  4. rekram1-node commented on Aug 27, 2025

    @rekram1-node
    Member

    @OliverGilan dax just updated the sdk, and I updated docs

    they haven't been published yet but here is commit fixing: 0fbd7c8

    Next time they are released this will be fixed

  5. OliverGilan commented on Aug 27, 2025

    @OliverGilan
    Author

    Incredible. Thank you both

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions