[英]Getting an AmazonKinesisException Status Code: 502 when using LocalStack from Java
I'm writing integration tests using LocalStack to mock out my calls to Kinesis.我正在使用 LocalStack 编写集成测试来模拟我对 Kinesis 的调用。 I've created a Kinesis client, but when I try to put records on Kinesis I get an error:
我创建了一个 Kinesis 客户端,但是当我尝试在 Kinesis 上放置记录时出现错误:
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:我尝试使用以下方法禁用 CBOR 和证书检查:
System.setProperty(SDKGlobalConfiguration.DISABLE_CERT_CHECKING_SYSTEM_PROPERTY, "false");
System.setProperty(SDKGlobalConfiguration.AWS_CBOR_DISABLE_SYSTEM_PROPERTY, "true"); 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.我每次都收到502。 Everything works fine for S3, it's just the Kinesis service that's giving me trouble.
S3 一切正常,只是 Kinesis 服务给我带来了麻烦。 Has anyone seen anything like this?
有没有人见过这样的事情?
I had a similar issue while connecting Kinesis over localstack locally.我在本地通过 localstack 连接 Kinesis 时遇到了类似的问题。 I was using the v2 SDK java library.
我正在使用 v2 SDK java 库。
Root cause根本原因
By default, kinesalite doesn't support CBOR and should be disabled to make it run.默认情况下,kinesalite 不支持 CBOR,应该禁用它以使其运行。 Internet is flooded with flags to disable CBOR but none of them worked for me.
互联网上充斥着禁用 CBOR 的标志,但没有一个对我有用。
You have to do two things:你必须做两件事:
AWS_CBOR_DISABLE=true
to tell localstack to stop usingAWS_CBOR_DISABLE=true
以告诉localstack停止使用aws.cborEnabled=false
to tell AWS SDK to stop using it.aws.cborEnabled=false
以告诉AWS 开发工具包停止使用它。 In my case, I was stuck with the SDK flag which is referred in software.amazon.awssdk.core.SdkSystemSetting
就我而言,我坚持使用
software.amazon.awssdk.core.SdkSystemSetting
引用的 SDK 标志
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.