aliyun-openapi-java-sdk icon indicating copy to clipboard operation
aliyun-openapi-java-sdk copied to clipboard

Cdn SDK接入报错

Open ghost opened this issue 9 years ago • 4 comments

com.aliyuncs.exceptions.ClientException: SDK.InvalidRegionId : Can not find endpoint to access. at com.aliyuncs.DefaultAcsClient.doAction(DefaultAcsClient.java:159) at com.aliyuncs.DefaultAcsClient.doAction(DefaultAcsClient.java:123) at com.aliyuncs.DefaultAcsClient.doAction(DefaultAcsClient.java:57)

自己使用的阿里云sdk核心包2.1.7 阿里云cdn sdk包版本为2.5.0 发现没有包含有 product name (Cdn) 建议完善响应sdk依赖阿里云核心包最低版本(希望有文档给说明下)

ghost avatar Sep 29 '17 04:09 ghost

我也遇到了相同的问题,cdn sdk中确实没有product name Cdn

wgslucky avatar Dec 06 '17 02:12 wgslucky

不想重新编译源码,就自己添加上去了, IClientProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, secret); List endpoints = profile.getEndpoints(); /** * 这里是cdn sdk的一个bug,它的配置文件中没有Cdn的ProductDomain的配置 */ for (Endpoint endpoint : endpoints) { if (endpoint.getName().equals(regionId)) { List productDomains = endpoint.getProductDomains(); ProductDomain cdnProductDomain = new ProductDomain("Cdn", "cdn.aliyuncs.com"); productDomains.add(cdnProductDomain); } }

wgslucky avatar Dec 06 '17 06:12 wgslucky

@wgslucky 是啊 阿里云的sdk 太坑了 各种看着不舒服。也有的地方描述的是模模糊糊。

ghost avatar Dec 26 '17 02:12 ghost

@shotdog @wgslucky 感谢您的反馈与贡献,给您带来了困扰,实在抱歉。

您可以在遇上类似问题时,查看对应产品的SDK文档,大多数情况下,会有一句类似

addEndpoint()

的代码来手动添加ProductDomain,也可以避免类似的问题出现。

我们之后会对endpoint resolve模块进行一次功能优化,尽可能地避免类似的错误再次发生,以降低用户使用成本。 再次感谢您的反馈与支持,谢谢!

gaort avatar Jan 12 '18 06:01 gaort