对象存储 POST Object 常见异常

这篇总结了COS API POST请求的常见错误码及解决方法,包括密钥不匹配、签名无效、Policy过期或格式错误等,并给出对应修复步骤。 密钥与签名错误:检查SecretId和签名生成规则,使用在线工具重新计算。 Policy相关错误:修改expiration时间或调整bucket/key条件,确保格式为标准JSON。 请求体格式错误:参考POST Object文档优化body格式。

相关产品
对象存储 产品页,含版本规格、价格与购买入口。

一、故障现象

使用 COS API 进行 POST 请求时,返回如下异常错误码:

·Condition key q-ak doesn't match the value XXXXXX

·You post object request has been expired, expiration time: 1621188104 but the time now : 1621245817

·The Signature you specified is invalid.

·You must provide condition if you specify a policy in post object request.

·Condition key bucket doesn't match the value [bucket-appid]

·Condition key key doesn't match the value XXXXX

·The body of your POST request is not well-formed multipart/form-data.

三、Message 为 “Condition key q-ak doesn't match the value XXXXXX”

当你使用 COS API 进行 POST 请求出现如下信息时:

<Code>AccessDenied</Code><Message>Condition key q-ak doesn&apos;t match the value XXXXXX</Message>

四、可能原因

q-ak 参数输入错误。

五、解决方法

1. 登录访问管理控制台,进入 API 密钥管理 页面,查看密钥信息。

2. 根据查看的密钥信息,确认 q-ak 参数是否输入错误。

·是,请将 q-ak 参数修改为正确的 SecretId。

·否,请 联系我们。

六、Message 为 “You post object request has been expired, expiration time: 1621188104 but the time now : 1621245817”

当你使用 COS API 进行 POST 请求出现如下信息时:

<Code>AccessDenied</Code><Message>You post object request has been expired, expiration time: 1621188104 but the time now : 1621245817</Message>

七、可能原因

Policy 中的 expiration 值已过期。

八、解决方法

请修改 Policy 中的 expiration 值。

注意:expiration 值需要晚于当前时间,建议设置为当前时间+30分钟(UTC 时间)。

九、Message 为 “The Signature you specified is invalid.”

当你使用 COS API 进行 POST 请求出现如下信息时:

<Code>SignatureDoesNotMatch</Code><Message>The Signature you specified is invalid.</Message>

十、可能原因

签名计算错误。

十一、解决方法

请参考 请求签名 文档,检查 POST 签名串生成规则是否正确。

·是,请 联系我们。

·否,请使用 在线辅助工具:COS 签名工具 重新计算 POST 请求签名。

十二、Message 为 “You must provide condition if you specify a policy in post object request.”

当你使用 COS API 进行 POST 请求出现如下信息时:

<Code>InvalidPolicyDocument</Code><Message>You must provide condition if you specify a policy in post object request.</Message>

十三、可能原因

Policy 格式错误。

十四、解决方法

请参考 POST Object 文档,将 Policy 格式修改为标准 JSON 格式。

十五、Message 为 “Condition key bucket doesn&apos;t match the value [bucket-appid]”

当你使用 COS API 进行 POST 请求出现如下信息时:

<Code>AccessDenied</Code><Message>Condition key bucket doesn&apos;t match the value [bucket-appid]</Message>

十六、可能原因

Policy 中的 bucket 与请求 bucket 不一致。

十七、解决方法

请使用 Policy 中的 bucket 进行请求。

十八、Message 为 “Condition key key doesn&apos;t match the value XXXXX”

当你使用 COS API 进行 POST 请求出现如下信息时:

<Code>AccessDenied</Code><Message>Condition key key doesn&apos;t match the value XXXXX</Message>

十九、可能原因

上传的内容不符合 policy 规则。

20、解决方法

根据 Policy 的 Condition,上传符合该条件的内容。

21、Message 为 “The body of your POST request is not well-formed multipart/form-data.”

当你使用 COS API 进行 POST 请求出现如下信息时:

<Code>MalformedPOSTRequest</Code><Message>The body of your POST request is not well-formed multipart/form-data.</Message>

22、可能原因

POST body 格式不符合规范。

23、解决方法

参考 POST Object 文档,优化 body 格式。

赞 (0)
上一篇 5天前
下一篇 5天前