stac-utils / stac-fastapi-elasticsearch-opensearch

Elasticsearch backend for stac-fastapi with Opensearch support.
https://stac-utils.github.io/stac-fastapi-elasticsearch-opensearch
MIT License
24 stars 14 forks source link

Red herring logs statement with Lambda + OpenSearch via AWS #268

Open RanbirAulakh opened 4 weeks ago

RanbirAulakh commented 4 weeks ago

Describe the bug I am not sure if the below issues is red herring or not.

[WARNING]    2024-06-04T21:23:56.100Z    70efc5df-4b3d-4aeb-a378-a2de04927917    PUT <aws os endpoint>:443/collections-000001 [status:400 request:0.041s]
[WARNING]    2024-06-04T21:23:56.142Z    70efc5df-4b3d-4aeb-a378-a2de04927917    GET <aws os endpoint>:443/collections/_doc/my_collection [status:404 request:0.031s]

I have fully deployed stac-fastapi-opensearch as a Lambda function. The dockerfile below:

FROM public.ecr.aws/lambda/python:3.10 as stac_catalog

RUN yum -y upgrade 
RUN yum -y install gcc
RUN yum -y install ca-certificates

RUN pip3 install stac_fastapi.core
RUN pip3 install stac_fastapi.opensearch[server]
RUN pip3 install mangum

EXPOSE 8080

CMD ["stac_fastapi.opensearch.app.handler"]

Along with the environment variables:

    public STAC_FASTAPI_TITLE: string = "stac-fastapi-opensearch",
    public STAC_FASTAPI_DESCRIPTION: string = "A STAC FastAPI with an OpenSearch backend",
    public STAC_FASTAPI_VERSION: string = "2.4.1",
    public RELOAD: string = "true",
    public ENVIRONMENT: string = "local",
    public WEB_CONCURRENCY: string = "10",
    public ES_HOST: string = "<os endpoint>"
    public ES_PORT: string = "443",
    public ES_USE_SSL: string = "true",
    public ES_VERIFY_CERTS: string = "true",
    public BACKEND: string = "opensearch"

Then, I have created the OpenSearch within the AWS. Both are located in the same VPC. I have setup the APIGateway in front of the Lambda function. When executing the curl command:

curl -X "POST" "<apigateway endpoint>.com/default/collections" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{ "id": "test_collection" }'

It was able to create it. But then we have warning that appears up (see above). Even if we performed the GET curl command, its the same warning we get above. It only shows up every time I performed a curl command.

So I am wondering if we are sending the bad malformed request. I am trying to track it down from your code:

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

I am expected for the status code to be 200 (?)

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

jamesfisher-gis commented 5 days ago

Hey, could you provide the error response returned in the STAC API logs?