The us-west-2 location constraint is incompatible for the region specific endpoint this request was sent to.


Pritimoy Podder
 

Hi,

I tried to run the following command from a Jupuyter Hub terminal but failed.
rio --aws-requester-pays info  s3://usgs-landsat/collection02/level-2/standard/oli-tirs/2014/168/061/LC08_L2SP_168061_20140102_20200912_02_T1/LC08_L2SP_168061_20140102_20200912_02_T1_SR_B4.TIF
Error:
Traceback (most recent call last):
  File "rasterio/_base.pyx", line 261, in rasterio._base.DatasetBase.__init__
  File "rasterio/_shim.pyx", line 78, in rasterio._shim.open_dataset
  File "rasterio/_err.pyx", line 216, in rasterio._err.exc_wrap_pointer
rasterio._err.CPLE_AWSError: The us-west-2 location constraint is incompatible for the region specific endpoint this request was sent to.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/opt/conda/bin/rio", line 8, in <module>
    sys.exit(main_group())
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/conda/lib/python3.9/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/opt/conda/lib/python3.9/site-packages/rasterio/rio/info.py", line 66, in info
    with ctx.obj['env'], rasterio.open(input) as src:
  File "/opt/conda/lib/python3.9/site-packages/rasterio/env.py", line 437, in wrapper
    return f(*args, **kwds)
  File "/opt/conda/lib/python3.9/site-packages/rasterio/__init__.py", line 220, in open
    s = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)
  File "rasterio/_base.pyx", line 263, in rasterio._base.DatasetBase.__init__
rasterio.errors.RasterioIOError: The us-west-2 location constraint is incompatible for the region specific endpoint this request was sent to.
GDAL version: 3.4.0
rasterio version: 1.2.10

The following command works as expected from the same environment and give me the feeling that the AWS access, secret access keys and region are properly set. 
aws s3api get-object --bucket usgs-landsat --key collection02/level-2/standard/oli-tirs/2020/026/027/LC08_L2SP_026027_20200827_20200906_02_T1/LC08_L2SP_026027_20200827_20200906_02_T1_MTL.txt  --request-payer requester LC08_L2SP_026027_20200827_20200906_02_T1_MTL.txt
Any thoughts?

Join main@rasterio.groups.io to automatically receive all group messages.