Aws-sdk-android: aws-android-sdk-logs error

Created on 25 Apr 2018  路  6Comments  路  Source: aws-amplify/aws-sdk-android

When i ve tried to send logs from Android client to Cloudwatch i ve received next error:

com.amazonaws.AmazonServiceException: Credential should be scoped to correct service: 'logs'. (Service: AmazonCloudWatchLogs; Status Code: 400; Error Code: InvalidSignatureException;

i m using aws-android-sdk-logs library.
Client has access and secret key, i ve setted correct region...
What i m doing wrong ?

Bug CloudWatch

Most helpful comment

Before Rohan fix that you can use a temporal solution: set ServiceName directly.
The issue is that AmazonCloudWatchLogsClient use wrong service name.
By def service name will be initialized using def httpClientName. To avoid it you can set ServiceName by yourself:

AmazonCloudWatchLogsClient client =  new AmazonCloudWatchLogsClient(credential);
client.setServiceNameIntern("logs");
// .. use client after ..

All 6 comments

Thank you @eashevchenko for reporting to us. What version of SDK are you using? Can you share a code snippet and the stacktrace?

Hello @eashevchenko

This is a bug due to incorrect configuration for signer. It will be fixed in next release of the SDK.

Thanks,
Rohan

Before Rohan fix that you can use a temporal solution: set ServiceName directly.
The issue is that AmazonCloudWatchLogsClient use wrong service name.
By def service name will be initialized using def httpClientName. To avoid it you can set ServiceName by yourself:

AmazonCloudWatchLogsClient client =  new AmazonCloudWatchLogsClient(credential);
client.setServiceNameIntern("logs");
// .. use client after ..

You are right @olehspavl

Thats a good work-around till we have the release out!

Fixed in version 2.6.19

Was this page helpful?
0 / 5 - 0 ratings