Getting an AmazonKinesisException Status Code: 502 when using LocalStack from Java

Melvin :

I'm writing integration tests using LocalStack to mock out my calls to Kinesis. I've created a Kinesis client, but when I try to put records on Kinesis I get an error:

com.amazonaws.services.kinesis.model.AmazonKinesisException: null (Service: AmazonKinesis; Status Code: 502; Error Code: null; Request ID: null)

I've tried disabling CBOR and cert checking with the following:

System.setProperty(SDKGlobalConfiguration.DISABLE_CERT_CHECKING_SYSTEM_PROPERTY, "false");

System.setProperty(SDKGlobalConfiguration.AWS_CBOR_DISABLE_SYSTEM_PROPERTY, "true");

I build the client this way:

.withEndpointConfiguration(localstack.getEndpointConfiguration(LocalStackContainer.Service.KINESIS))
.withCredentials(localstack.getDefaultCredentialsProvider())
.build()```

I get a 502 every time.  Everything works fine for S3, it's just the Kinesis service that's giving me trouble.   Has anyone seen anything like this?
Rites :

I had a similar issue while connecting Kinesis over localstack locally. I was using the v2 SDK java library.

Root cause

By default, kinesalite doesn't support CBOR and should be disabled to make it run. Internet is flooded with flags to disable CBOR but none of them worked for me.

You have to do two things:

  1. Set environment var AWS_CBOR_DISABLE=true to tell localstack to stop using
  2. Set environment var aws.cborEnabled=false to tell AWS SDK to stop using it.

In my case, I was stuck with the SDK flag which is referred in software.amazon.awssdk.core.SdkSystemSetting

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=117472&siteId=1