It seems that stac-fastapi-sqlalchemy does not support STAC items that have "datetime": null, even though it is specified in STAC spec https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md#properties-object. When I submit a request to the endpoint: POST /collections/hls-agb-preprocessed/bulk_items I get HTTP/1.1" 500 Internal Server Error. Am I doing something wrong? Please let me know if you need any clarification. Thanks!
INFO: 10.128.20.1:42998 - "POST /collections/hls-agb-preprocessed/bulk_items HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/usr/local/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 289, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.8/site-packages/stac_fastapi/api/middleware.py", line 75, in __call__
await self.app(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/cors.py", line 83, in __call__
await self.app(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/brotli_asgi/__init__.py", line 85, in __call__
await gzip_responder(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/gzip.py", line 44, in __call__
await self.app(scope, receive, self.send_with_gzip)
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/usr/local/lib/python3.8/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
raise e
File "/usr/local/lib/python3.8/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
await self.app(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.8/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 273, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.8/site-packages/fastapi/routing.py", line 190, in run_endpoint_function
return await dependant.call(**values)
File "/usr/local/lib/python3.8/site-packages/stac_fastapi/api/routes.py", line 68, in _endpoint
await func(request_data, request=request), response_class
File "/usr/local/lib/python3.8/site-packages/stac_fastapi/api/routes.py", line 32, in run
return await run_in_threadpool(func, *args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "/usr/local/lib/python3.8/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/app/stac_fastapi/sqlalchemy/transactions.py", line 193, in bulk_item_insert
processed_items = [self._preprocess_item(item) for item in items]
File "/app/stac_fastapi/sqlalchemy/transactions.py", line 193, in <listcomp>
processed_items = [self._preprocess_item(item) for item in items]
File "/app/stac_fastapi/sqlalchemy/transactions.py", line 182, in _preprocess_item
db_model = self.item_serializer.stac_to_db(item)
File "/app/stac_fastapi/sqlalchemy/serializers.py", line 108, in stac_to_db
field_value = rfc3339_str_to_datetime(field_value)
File "/usr/local/lib/python3.8/site-packages/stac_fastapi/types/rfc3339.py", line 30, in rfc3339_str_to_datetime
s = s.upper()
AttributeError: 'NoneType' object has no attribute 'upper'
Hello everyone,
It seems that stac-fastapi-sqlalchemy does not support STAC items that have
"datetime": null
, even though it is specified in STAC spec https://github.com/radiantearth/stac-spec/blob/master/item-spec/item-spec.md#properties-object. When I submit a request to the endpoint:POST /collections/hls-agb-preprocessed/bulk_items
I getHTTP/1.1" 500 Internal Server Error
. Am I doing something wrong? Please let me know if you need any clarification. Thanks!Please see below a slice of the item file:
This is the error message: