MAAP-Project / maap-documentation

9 stars 12 forks source link

Clarify which DAACs can be accessed with maap.aws.earthdata_s3_credentials (NSIDC error) #352

Open wildintellect opened 8 months ago

wildintellect commented 8 months ago

MAAP has the ability to authenticate to S3 endpoints for EarthDataCloud. The Docs needs to specifically state which DAACs this works with and what credentials url to use.

NSIDC seems to be throwing an error for users. Seems we knew about this, but I don't have a record of the issue. @bsatoriu is it just that NSIDC doesn't support federated tokens?

Example Code

from maap.maap import MAAP
maap = MAAP()

check = maap.aws.earthdata_s3_credentials("https://data.nsidc.earthdatacloud.nasa.gov/s3credentials")
check
---------------------------------------------------------------------------
HTTPError                                 Traceback (most recent call last)
Input In [9], in <cell line: 1>()
----> 1 check = maap.aws.earthdata_s3_credentials("https://data.nsidc.earthdatacloud.nasa.gov/s3credentials")
      2 check

File /maap-py/maap/AWS.py:61, in AWS.earthdata_s3_credentials(self, endpoint_uri)
     56 _url = self._earthdata_s3_credentials_endpoint.replace(
     57     "{endpoint_uri}", _parsed_endpoint
     58 )
     60 response = requests.get(url=_url, headers=self._api_header)
---> 61 response.raise_for_status()
     63 result = json.loads(response.text)
     64 result["DAAC"] = urllib.parse.urlparse(endpoint_uri).netloc

File ~/.local/lib/python3.10/site-packages/requests/models.py:960, in Response.raise_for_status(self)
    957     http_error_msg = u'%s Server Error: %s for url: %s' % (self.status_code, reason, self.url)
    959 if http_error_msg:
--> 960     raise HTTPError(http_error_msg, response=self)

HTTPError: 500 Server Error: INTERNAL SERVER ERROR for url: https://api.maap-project.org/api/members/self/awsAccess/edcCredentials/https%253A%252F%252Fdata.nsidc.earthdatacloud.nasa.gov%252Fs3credentials