Endpoint error when accessing an OSS bucket using an SDK

Updated at:

Problem description

The following error is returned when you use a software development kit (SDK) to access a bucket in Object Storage Service (OSS).

The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint

Cause

This error occurs if the Endpoint parameter is not specified or is incorrect. For example, if your bucket is in the Qingdao region but your request uses the default endpoint for the Hangzhou region, oss-cn-hangzhou.aliyuncs.com, the request fails.

Solution

Check the endpoint of your OSS bucket.

  • Ensure that you use the correct endpoint to access the bucket. For example, if the bucket is in the oss-cn-hangzhou region, the public endpoint is oss-cn-hangzhou.aliyuncs.com. For more information about endpoints, see Usage rules for OSS domain names.

  • Confirm that the endpoint in your request matches the actual endpoint of the bucket. To access buckets in both the Qingdao and Hangzhou regions, you must create multiple OSSClient instances. When you define the endpoints, add the addresses for both the Qingdao and Hangzhou regions. For more information about the endpoints for each region and network connectivity type, see Endpoint.

More information

  • For the public and private network endpoints for each OSS region, see Regions and endpoints.

  • For more information about the Java SDK, see Java SDK.

Applies to

  • Object Storage Service