从 Java 使用 LocalStack 时获取 AmazonKinesisException 状态代码:502 [英] Getting an AmazonKinesisException Status Code: 502 when using LocalStack from Java

查看:24
本文介绍了从 Java 使用 LocalStack 时获取 AmazonKinesisException 状态代码:502的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 LocalStack 编写集成测试来模拟我对 Kinesis 的调用.我已经创建了一个 Kinesis 客户端,但是当我尝试在 Kinesis 上放置记录时出现错误:

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(服务:AmazonKinesis;状态代码:502;错误代码:null;请求 ID:null)

我尝试通过以下方式禁用 CBOR 和证书检查:

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");

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()

我每次都收到 502.S3 一切正常,只是 Kinesis 服务给我带来了麻烦.有人见过这样的吗?

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?

推荐答案

我在本地通过 localstack 连接 Kinesis 时遇到了类似的问题.我正在使用 v2 SDK java 库.

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

根本原因

默认情况下,kinesalite 不支持 CBOR,应该禁用它以使其运行.互联网上充斥着禁用 CBOR 的标志,但没有一个对我有用.

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.

你必须做两件事:

  1. 设置环境变量 AWS_CBOR_DISABLE=true 以告诉 localstack 停止使用
  2. 设置环境变量 aws.cborEnabled=false 以告诉 AWS SDK 停止使用它.
  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.

就我而言,我被 software.amazon.awssdk.core.SdkSystemSetting

这篇关于从 Java 使用 LocalStack 时获取 AmazonKinesisException 状态代码:502的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆