Titiler deployed in AWS Lambda returns empty PNGs #570
-
Hello everyone! I made a deployment of the default All other routes seem to work fine and return appropriate values, for instance My lambda has been deployed with the recommended environment variables described in the docs, specifically: {
"GDAL_CACHEMAX": "200", # 200 mb
"GDAL_DISABLE_READDIR_ON_OPEN": "EMPTY_DIR",
"GDAL_INGESTED_BYTES_AT_OPEN": "32768",
"GDAL_HTTP_MERGE_CONSECUTIVE_RANGES": "YES",
"GDAL_HTTP_MULTIPLEX": "YES",
"GDAL_HTTP_VERSION": "2",
"PYTHONWARNINGS": "ignore",
"VSI_CACHE": "TRUE",
"VSI_CACHE_SIZE": "5000000", # 5 MB (per file-handle),
"CPL_VSIL_CURL_ALLOWED_EXTENSIONS": ".tif,.TIF,.tiff",
"RIO_TILER_MAX_THREADS": "1",
"TITILER_API_DEBUG": "1",
"TITILER_API_ROOT_PATH": "/prod",
"DISABLE_STAC": "true",
"DISABLE_MOSAIC": "true",
"PYTHONUNBUFFERED": "1"
} This is my app definition: """Minimal COG tiler."""
from mangum import Mangum
from titiler.application.main import app
handler = Mangum(app, lifespan="auto") Initially I had considered that this was due to some misconfiguration in my cogeo. Looking through the logs I don't see any errors/warnings. But it seems that the same behaviour occurs with other cogeos, like this one: Strangely enough, serving the app from my local machine using Any idea what could cause the returned tiles to be empty/transparent? Any help would be very much appreciated! This is the requirements I have in the app:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
it's weird because it seems to work with the generic titiler deployment https://titiler.xyz/cog/WorldCRS84Quad/map?url=s3://jua-map-tiles/rasters/FULL_VAR_2T_2021-01-01T00:00:00.000000000.tif&rescale=-30,30&colormap_name=viridis |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply @vincentsarago! Hope you are doing well 🙌 I'm an idiot: I didn't setup my API gateway correctly, so the content was not getting base64 decoded when the images were returned from the Lambda. Enabling binary content type of Partly this is also due to me using AWS CDK v2 - which remove the possibility of using an HTTP API integration for Lambda. Here is the API gateway definition that works for AWS CDK v2:
|
Beta Was this translation helpful? Give feedback.
Thanks for the quick reply @vincentsarago! Hope you are doing well 🙌
I'm an idiot: I didn't setup my API gateway correctly, so the content was not getting base64 decoded when the images were returned from the Lambda. Enabling binary content type of
*/*
sorted the issue out.Partly this is also due to me using AWS CDK v2 - which remove the possibility of using an HTTP API integration for Lambda. Here is the API gateway definition that works for AWS CDK v2: