When searching for a file in the python client e2e tests without passing a file_id or a checksum I get a 500 from the api server. In graylog I see
{
"log_timestamp": "2024-11-18 06:06:55,787",
"gl2_receive_timestamp": "2024-11-18 06:06:55.792",
"HOUR": "06",
"gl2_remote_ip": "10.0.0.4",
"gl2_remote_port": 51864,
"source": "osparc-master-06",
"gl2_source_input": "65521f932a58973a4142120a",
"image_name": "itisfoundation/api-server:master-github-latest@sha256:b02c790fbc85b7c78fbd981049e522ab3254a2a04c9c2d271b33cc4653296276",
"gl2_processing_timestamp": "2024-11-18 06:06:55.793",
"YEAR": "2024",
"log_service": "master-simcore_master_api-server",
"gl2_source_node": "3040a8ec-ff3e-451a-9147-d55531a49f20",
"MINUTE": "06",
"tag": "90fef9405355",
"gl2_processing_duration_ms": 1,
"timestamp": "2024-11-18T06:06:55.789Z",
"gl2_accounted_message_size": 7974,
"MONTHNUM": "11",
"level": 3,
"log_msg": "Oops! Something went wrong, but we've noted it down and we'll sort it out ASAP. Thanks for your patience! [OEC:140092442452864].\n{'context': '{}',\n 'error_code': 'OEC:140092442452864',\n 'exception_details': 'Invalid file_id '\n 'cbcd46d6-4437-11ef-9376-02420a00f1c4/c9c8ffd8-e5b3-5d60-95ef-31d53799f40e/single_number.txt '\n 'in file metadata',\n 'exception_type': \"<class 'ValueError'>\",\n 'tip': 'Unexpected error'}\nTraceback (most recent call last):\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py\", line 162, in __call__\n await self.app(scope, receive, _send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/prometheus_fastapi_instrumentator/middleware.py\", line 169, in __call__\n raise exc\n File \"/home/scu/.venv/lib/python3.11/site-packages/prometheus_fastapi_instrumentator/middleware.py\", line 167, in __call__\n await self.app(scope, receive, send_wrapper)\n File \"/home/scu/.venv/lib/python3.11/site-packages/servicelib/fastapi/profiler_middleware.py\", line 48, in __call__\n await self._app(scope, receive, send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/opentelemetry/instrumentation/asgi/__init__.py\", line 735, in __call__\n await self.app(scope, otel_receive, otel_send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py\", line 79, in __call__\n raise exc\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py\", line 68, in __call__\n await self.app(scope, receive, sender)\n File \"/home/scu/.venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py\", line 20, in __call__\n raise e\n File \"/home/scu/.venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py\", line 17, in __call__\n await self.app(scope, receive, send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/routing.py\", line 718, in __call__\n await route.handle(scope, receive, send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/routing.py\", line 276, in handle\n await self.app(scope, receive, send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/routing.py\", line 66, in app\n response = await func(request)\n ^^^^^^^^^^^^^^^^^^^\n File \"/home/scu/.venv/lib/python3.11/site-packages/fastapi/routing.py\", line 241, in app\n raw_response = await run_endpoint_function(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/scu/.venv/lib/python3.11/site-packages/fastapi/routing.py\", line 167, in run_endpoint_function\n return await dependant.call(**values)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/scu/.venv/lib/python3.11/site-packages/simcore_service_api_server/api/routes/files.py\", line 317, in search_files_page\n [to_file_api_model(fmd) for fmd in stored_files],\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/scu/.venv/lib/python3.11/site-packages/simcore_service_api_server/api/routes/files.py\", line 317, in <listcomp>\n [to_file_api_model(fmd) for fmd in stored_files],\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/scu/.venv/lib/python3.11/site-packages/simcore_service_api_server/services/storage.py\", line 38, in to_file_api_model\n raise ValueError(msg)\nValueError: Invalid file_id cbcd46d6-4437-11ef-9376-02420a00f1c4/c9c8ffd8-e5b3-5d60-95ef-31d53799f40e/single_number.txt in file metadata",
"created": "2024-11-15T16:43:23.268887266Z",
"streams": [
"000000000000000000000001"
],
"log_level": "ERROR",
"gl2_message_id": "01JCYY36SD000548SMMZP4DPTH",
"message": "log_level=ERROR | log_timestamp=2024-11-18 06:06:55,787 | log_source=/home/scu/.venv/lib/python3.11/site-packages/simcore_service_api_server/exceptions/handlers/_handlers_factory.py:_http_error_handler(42) | log_uid=None | log_msg=Oops! Something went wrong, but we've noted it down and we'll sort it out ASAP. Thanks for your patience! [OEC:140092442452864].\n{'context': '{}',\n 'error_code': 'OEC:140092442452864',\n 'exception_details': 'Invalid file_id '\n 'cbcd46d6-4437-11ef-9376-02420a00f1c4/c9c8ffd8-e5b3-5d60-95ef-31d53799f40e/single_number.txt '\n 'in file metadata',\n 'exception_type': \"<class 'ValueError'>\",\n 'tip': 'Unexpected error'}\nTraceback (most recent call last):\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/middleware/errors.py\", line 162, in __call__\n await self.app(scope, receive, _send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/prometheus_fastapi_instrumentator/middleware.py\", line 169, in __call__\n raise exc\n File \"/home/scu/.venv/lib/python3.11/site-packages/prometheus_fastapi_instrumentator/middleware.py\", line 167, in __call__\n await self.app(scope, receive, send_wrapper)\n File \"/home/scu/.venv/lib/python3.11/site-packages/servicelib/fastapi/profiler_middleware.py\", line 48, in __call__\n await self._app(scope, receive, send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/opentelemetry/instrumentation/asgi/__init__.py\", line 735, in __call__\n await self.app(scope, otel_receive, otel_send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py\", line 79, in __call__\n raise exc\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py\", line 68, in __call__\n await self.app(scope, receive, sender)\n File \"/home/scu/.venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py\", line 20, in __call__\n raise e\n File \"/home/scu/.venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py\", line 17, in __call__\n await self.app(scope, receive, send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/routing.py\", line 718, in __call__\n await route.handle(scope, receive, send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/routing.py\", line 276, in handle\n await self.app(scope, receive, send)\n File \"/home/scu/.venv/lib/python3.11/site-packages/starlette/routing.py\", line 66, in app\n response = await func(request)\n ^^^^^^^^^^^^^^^^^^^\n File \"/home/scu/.venv/lib/python3.11/site-packages/fastapi/routing.py\", line 241, in app\n raw_response = await run_endpoint_function(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/scu/.venv/lib/python3.11/site-packages/fastapi/routing.py\", line 167, in run_endpoint_function\n return await dependant.call(**values)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/scu/.venv/lib/python3.11/site-packages/simcore_service_api_server/api/routes/files.py\", line 317, in search_files_page\n [to_file_api_model(fmd) for fmd in stored_files],\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/scu/.venv/lib/python3.11/site-packages/simcore_service_api_server/api/routes/files.py\", line 317, in <listcomp>\n [to_file_api_model(fmd) for fmd in stored_files],\n ^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/scu/.venv/lib/python3.11/site-packages/simcore_service_api_server/services/storage.py\", line 38, in to_file_api_model\n raise ValueError(msg)\nValueError: Invalid file_id cbcd46d6-4437-11ef-9376-02420a00f1c4/c9c8ffd8-e5b3-5d60-95ef-31d53799f40e/single_number.txt in file metadata",
"command": "/bin/sh services/api-server/docker/entrypoint.sh /bin/sh services/api-server/docker/boot.sh",
"container_name": "master-simcore_master_api-server.1.id0lg4r1iskstgzi3d9zei7n4",
"log_uid": "None",
"log_source": "/home/scu/.venv/lib/python3.11/site-packages/simcore_service_api_server/exceptions/handlers/_handlers_factory.py:_http_error_handler(42)",
"SECOND": "55,787",
"_id": "503f6a10-a573-11ef-9a4b-0242c0a8020b",
"image_id": "sha256:ffc2124772fad1b222a79d9f2c1731f7792287d2dac3c0218286e3be37b9a527",
"container_id": "90fef9405355d55123c037264dbb1ba39e2c2ff04b31ef3727f290569b42757f",
"MONTHDAY": "18"
}
This should either be a client error because one should have to pass some data when searching or the search should simply return all possible files. So probably we want this to be a client error.
Is there an existing issue for this?
Which deploy/s?
No response
Current Behavior
When searching for a file in the python client e2e tests without passing a
file_id
or a checksum I get a 500 from the api server. In graylog I seeThis should either be a client error because one should have to pass some data when searching or the search should simply return all possible files. So probably we want this to be a client error.
To test this, run https://github.com/bisgaard-itis/osparc-simcore-clients/blob/a2a0994460f689bdaf579f855730cb1bd94e14df/clients/python/test/e2e/test_files_api.py#L91 with
(use_checksum, use_id)=(False, False)
.Expected Behavior
No response
Steps To Reproduce
No response
Anything else?
No response