Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error During Policy Data Update Trigger (Object NoneType in 'await' Expression) #762

Open
pack-geni opened this issue Feb 14, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@pack-geni
Copy link

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

  1. Trigger a data update via API:
    curl -XPOST http://localhost:7766/data-updater/trigger
  2. The first attempt works fine with response {"status": "ok"}.
  3. 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
@pack-geni pack-geni added the bug Something isn't working label Feb 14, 2025
@orweis
Copy link
Contributor

orweis commented Feb 14, 2025

Hi @pack-geni thanks for the report.
We'll look into this.

CC: @danyi1212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants