-
Notifications
You must be signed in to change notification settings - Fork 565
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
BedrockRuntimeClient ConverseStreamCommand can't receive any response in react native #6394
Comments
HI @zhu-xiaowei - thanks for reaching out. It sounds like SDK call was made successfully as you receive the response from client but not from import {
BedrockRuntimeClient,
ConverseStreamCommand,
} from "@aws-sdk/client-bedrock-runtime"; // ES Modules import
const client = new BedrockRuntimeClient(config);
const input = {
modelId: "STRING_VALUE",
messages: messages,
};
const command = new ConverseStreamCommand(input);
const response = await client.send(command); Before i attempt to reproduce with React Native, can you clarify a few things:
|
Hi @aBurmeseDev, thanks for working on this issue, here are more details:
|
To correct, the error above is because I also added another polyfill:
Then I tried to add polyfill
In short, I can't find a way to successfully read the results returned by the straming model in the React Native environment: const apiResponse = await client.send(command);
for await (const item of apiResponse.stream) {
console.log(item); // can't get the streaming response.
} |
Checkboxes for prior research
Describe the bug
When using
BedrockRuntimeClient
in React Native environment,InvokeModelCommand
works well, butConverseStreamCommand
andInvokeModelWithResponseStreamCommand
will not return any response.And I've read the getting-started for react native and added following imports
then added blow code in
metro.config.js
the bedrock code as:
client.send(command)
works well, and the log forapiResponse.stream
is:The
for await
block never goes inside, then I try to remove the transformer inmetro.config.js
and theapiResponse.stream
will return the following error:I don't know what configuration I'm missing or is there any sample code for calling methods of
ConverseStreamCommand
orInvokeModelWithResponseStreamCommand
in a React Native environment?SDK version number
"@aws-sdk/client-bedrock-runtime": "^3.614.0"
Which JavaScript Runtime is this issue in?
React Native
Details of the browser/Node.js/ReactNative version
"react-native": "0.74.5"
Reproduction Steps
see the above describe.
Observed Behavior
ConverseStreamCommand
command send successfully butapiResponse.stream
receive without any streaming response.Expected Behavior
can receive the streaming response for
ConverseStreamCommand
Possible Solution
No response
Additional Information/Context
The credentials are configured correctly and the same code runs perfectly in the
node
environment.The text was updated successfully, but these errors were encountered: