0020-00000045

Updated at:

Problem description

PutBucketInventory returns an error because IncludedObjectVersions is set to All on a bucket that does not have versioning enabled.

Causes

IncludedObjectVersions=All exports all object versions and requires versioning to be enabled on the bucket. The bucket in the request has versioning disabled.

Examples

The following request sets IncludedObjectVersions to All on the bucket oss-example, which has versioning disabled.

PUT /?inventory&inventoryId=report1 HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Mon, 31 Oct 2016 12:00:00 GMT
Authorization: authorization string
Content-Length: length

<?xml version="1.0" encoding="UTF-8"?>
<InventoryConfiguration>
   <Id>report1</Id>
   <IsEnabled>true</IsEnabled>
   <Filter>
       <Prefix>Pics/</Prefix>
       <LastModifyBeginTimeStamp>1637883649</LastModifyBeginTimeStamp>
       <LastModifyEndTimeStamp>1638347592</LastModifyEndTimeStamp>
       <LowerSizeBound>1024</LowerSizeBound>
       <UpperSizeBound>1048576</UpperSizeBound>
       <StorageClass>Standard,IA</StorageClass>
   </Filter>
   <Destination>
      <OSSBucketDestination>
        <Format>CSV</Format>
        <AccountId>100000000000000</AccountId>
        <RoleArn>acs:ram::100000000000000:role/AliyunOSSRole</RoleArn>
        <Bucket>acs:oss:::destbucket</Bucket>
        <Prefix>prefix1/</Prefix>
        <Encryption>
           <SSE-KMS>
              <KeyId>keyId</KeyId>
           </SSE-KMS>
         </Encryption>
      </OSSBucketDestination>
   </Destination>
   <Schedule>
      <Frequency>Weekly</Frequency>
   </Schedule>
   <IncludedObjectVersions>All</IncludedObjectVersions>
   <OptionalFields>
      <Field>Size</Field>
      <Field>LastModifiedDate</Field>
      <Field>ETag</Field>
      <Field>StorageClass</Field>
      <Field>IsMultipartUploaded</Field>
      <Field>EncryptionStatus</Field>
   </OptionalFields>
</InventoryConfiguration>
Note: The <IncludedObjectVersions>All</IncludedObjectVersions> element causes this error. All exports all object versions and requires versioning to be enabled on the bucket.

Solutions

Choose one of the following options:

  • Export only the current version of each object — Change IncludedObjectVersions to Current in the request body.

  • Keep IncludedObjectVersions set to All — Enable versioning on the bucket first. For instructions, see Overview.

References

PutBucketInventory