๐ @ERM, first let me thank you for this great awesome library, as the author of another proxy for aws lambda I know this can be a ๐ณ๏ธ sometimes.
I'm currently working on https://github.com/developmentseed/titiler which is a FastAPI based tile server. When deploying the lambda function using mangum and the new api gateway HTTP endpoint, most of my endpoints works except for the ones where I call request.url.scheme
e.g: https://github.com/developmentseed/titiler/blob/master/titiler/api/api_v1/endpoints/metadata.py#L59
and I get AttributeError: 'str' object has no attribute 'decode'
Logs
File "/tmp/pip-unpacked-wheel-a0vaawkp/titiler/api/api_v1/endpoints/metadata.py", line 59, in tilejson
File "/tmp/pip-unpacked-wheel-xa0z_c8l/starlette/requests.py", line 56, in url
File "/tmp/pip-unpacked-wheel-xa0z_c8l/starlette/datastructures.py", line 45, in __init__
AttributeError: 'str' object has no attribute 'decode'
So looking at my cloudwatch logs I can deduce:
-
in https://github.com/encode/starlette/blob/97257515f8806b8cc519d9850ecadd783b3008f9/starlette/datastructures.py#L45 starlette expect the query_string to be a byte literal
-
in https://github.com/erm/mangum/blob/4fbf1b0d7622c19385a549eddfb603399a125bbb/mangum/adapter.py#L100-L106
it seems that Mangum is getting the rawQueryString for the event, and in my case I think this would be a string instead of a byte literal.
I'll work on adding logging and test in my app to confirm this, but I wanted to share this to see if I was making sense ;-)
Thanks
๐ @ERM, first let me thank you for this
greatawesome library, as the author of anotherproxyfor aws lambda I know this can be a ๐ณ๏ธ sometimes.I'm currently working on https://github.com/developmentseed/titiler which is a FastAPI based tile server. When deploying the lambda function using mangum and the new api gateway HTTP endpoint, most of my endpoints works except for the ones where I call
request.url.schemee.g: https://github.com/developmentseed/titiler/blob/master/titiler/api/api_v1/endpoints/metadata.py#L59
and I get
AttributeError: 'str' object has no attribute 'decode'Logs
So looking at my cloudwatch logs I can deduce:
in https://github.com/encode/starlette/blob/97257515f8806b8cc519d9850ecadd783b3008f9/starlette/datastructures.py#L45 starlette expect the
query_stringto be a byte literalin https://github.com/erm/mangum/blob/4fbf1b0d7622c19385a549eddfb603399a125bbb/mangum/adapter.py#L100-L106
it seems that Mangum is getting the
rawQueryStringfor the event, and in my case I think this would be a string instead of a byte literal.I'll work on adding logging and test in my app to confirm this, but I wanted to share this to see if I was making sense ;-)
Thanks