-
Notifications
You must be signed in to change notification settings - Fork 264
Description
Describe the bug
After upgrading from permitio/opal-client:0.7.15 to permitio/opal-client:0.7.16, triggering a data update via the API results in an error.
To Reproduce
- Trigger a data update via API:
curl -XPOST http://localhost:7766/data-updater/trigger - The first attempt works fine with response {"status": "ok"}.
- However, the second attempt fails with the response {"detail":"Failed to update data"} and the following logs:
opal_client_1 | 2025-02-14T06:13:24.792695+0000 | 17 | opal_client.data.api | INFO | triggered policy data update from api
opal_client_1 | 2025-02-14T06:13:24.793278+0000 | 17 | opal_client.data.api |ERROR | Error during data update: object NoneType can't be used in 'await' expression
opal_client_1 | 2025-02-14T06:13:24.793762+0000 | 17 | uvicorn.protocols.http.httptools_impl | INFO | 192.168.0.1:42128 - "POST /data-updater/trigger HTTP/1.1" 500
The settings used were:
https://github.com/permitio/opal/blob/master/docker/docker-compose-example.yml
The following error occurs in the opal_client.data.api module:
Error during data update: object NoneType can't be used in 'await' expression
The issue seems to be triggered by the _handle_policy_data_update function in the opal_client/data/api.py file:
19 async def _handle_policy_data_update(span=None):
20 try:
21 if data_updater:
22 async with start_span("opal_client_data_update_apply") if span else (
23 await None
24 ):
25 await data_updater.get_base_policy_data(
26 data_fetch_reason="request from sdk"
27 )
28 return {"status": "ok"}
The error seems related to the tracing logic, as shown in the following code in opal-common/monitoring/tracing_utils.py:
17 if not opal_common_config.ENABLE_OPENTELEMETRY_TRACING:
18 yield None
19 return
Expected behavior
The data update should trigger successfully and return the expected response without errors.
Screenshots
If applicable, add screenshots to help explain your problem.
OPAL version
- Version: 0.7.16