-
Notifications
You must be signed in to change notification settings - Fork 624
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
I was running DescribeLogStreamsCommand
to verify if the log stream is existed in the React-Native. I got the response is undefined
. But when I run the same code by node
command, it worked, it could get the correct response.
And then I tried to verify my account, then same issue. Got an error {"$metadata":{"attempts":1,"totalRetryDelay":0}}
. It worked by node
, got the correct response structure.
Regression Issue
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
React Native
Details of the browser/Node.js/ReactNative version
[email protected] [email protected]
Reproduction Steps
const client = new CloudWatchLogsClient({
credentials: {
accessKeyId: "XXXXXXXXXXXXXXX",
secretAccessKey: "YYYYYYYYYYYYYYYYYY",
},
region: "us-west-2",
maxAttempts: 3
});
const verifyLogStream = async (aa) => {
try {
const response = await client.send(new DescribeLogStreamsCommand({
logGroupName: "XXXXXX",
logStreamNamePrefix: `YYYY_${ aa }_Logs`,
}));
console.log('DescribeLogStreamsCommand response:', response.logStreams);
return true;
} catch (error) {
console.error('Error describing log streams:', error);
return false;
}
};
verifyLogStream(13);
export const verifyAcount = async (region) => {
const stsClient = new STSClient({
credentials: {
accessKeyId: "XXXXXXXXXX",
secretAccessKey: "YYYYYYYYYYYYYYYYY",
accountId: "ZZZZZZZZZZZZ"
},
region: region,
maxAttempts: 3
});
try {
const whoAmI = await stsClient.send(new GetCallerIdentityCommand({}));
console.log(region, ': Caller identity:', whoAmI);
} catch (error) {
console.error(region, ": Caller identity error:", JSON.stringify(error));
}
}
verifyAcount("us-west-2");`
Observed Behavior
Under the React-Native:
For verifyLogStream
, it got DescribeLogStreamsCommand response: undefined
For verifyAcount
, it got an Error us-west-2 : Caller identity error: {"$metadata":{"attempts":1,"totalRetryDelay":0}}
Expected Behavior
Under the React-Native:
For verifyLogStream
, it should get the correct response structure:
[ { arn: 'arn:aws:logs:us-west-2:XXXXXXXXXXXX:log-group:rotender-native:log-stream:YYYY_13_Logs', creationTime: 1716831570343, firstEventTimestamp: 1716831570449, lastEventTimestamp: 1739839755726, lastIngestionTime: 1739839755777, logStreamName: 'YYYY_13_Logs', storedBytes: 0, uploadSequenceToken: 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ' } ]
For verifyAcount
, it should get the correct response structure
{ '$metadata': { httpStatusCode: 200, requestId: '7277b8ee-9488-476f-93ee-89e1f17b534b', extendedRequestId: undefined, cfId: undefined, attempts: 1, totalRetryDelay: 0 }, UserId: 'XXXXXXXXXXXXXXXX', Account: 'XXXXXXXXXXXXXXX', Arn: 'arn:aws:iam::XXXXXXXXXXX:user/YYYYYYYYY' }
Possible Solution
No response
Additional Information/Context
No response