Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(eventstream-handler-node): start streaming without waiting for response #6311

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

kuhe
Copy link
Contributor

@kuhe kuhe commented Jul 25, 2024

Issue

internal V1360694816

Description

This sets the event stream payload handler to begin streaming the input payload without waiting for any server response. QBusiness does not send any initial response ack, whereas TranscribeStreaming does. However, since we don't need to handle this ack in any way, we can start the stream regardless in both cases.

Testing

import { ChatCommand, QBusinessClient } from "@aws-sdk/client-qbusiness";

const client = new QBusinessClient;

const command = new ChatCommand({
  applicationId: "49.....-....-....-....-.....c9",
  inputStream: (async function* () {
    yield { textEvent: { userMessage: "say hi" } };
    yield { endOfInputEvent: {} };
  })(),
});

const response = await client.send(command);
for await (const event of response.outputStream!) {
  process.stdout.write(event?.textEvent?.systemMessage ?? "");
}
Generating an answer based on what I know...

 Hi!

I tested TranscribeStreaming as well, and it still works.

Additional context

I'm not able to add an E2E test at this time because of the complexity of setting up the resource.

HTTP2 does not require any sort of ack to begin bi-directional streaming. That was an assumption of our legacy code given how AWS services at the time behaved.

@kuhe kuhe requested a review from a team as a code owner July 25, 2024 00:50
@kuhe kuhe self-assigned this Jul 25, 2024
@siddsriv siddsriv merged commit 0072f42 into aws:main Jul 25, 2024
5 checks passed
@kuhe kuhe deleted the fix/eventstream branch July 25, 2024 14:39
Copy link

github-actions bot commented Aug 9, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants