You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "Robinyo (via GitHub)" <gi...@apache.org> on 2025/06/23 23:49:07 UTC

[I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Robinyo opened a new issue, #12374:
URL: https://github.com/apache/apisix/issues/12374

   ### Current Behavior
   
   I have followed the steps in the [documentation](https://apisix.apache.org/docs/apisix/plugins/opa/) to configure the OPA plugin.
   
   For example:
   
   ```
     - name: provider-directory-api-organization-read
       uri: /fhir/Organization*
       methods: [ "GET" ]
       upstream_id: 1
       plugins:
         opa:
           host: "http://opa:8181"
           ssl_verify: false
           with_route: true
           policy: "organization/allow"
   ```
   
   Sample policy:
   
   ```
   package organisation
   
   import input.request
   
   default allow := false
   
   allow if {
   	request.method == "GET"
   }
   ```
   
   OPA logs:
   
   ```
   {
     "client_addr": "172.18.0.1:59868",
     "level": "info",
     "msg": "Received request.",
     "req_body": "package organisation\n      \n  result := true",
     "req_id": 6,
     "req_method": "PUT",
     "req_params": {},
     "req_path": "/v1/policies/organization",
     "time": "2025-06-23T22:58:41Z"
   }
   {
     "client_addr": "172.18.0.1:59868",
     "level": "info",
     "msg": "Sent response.",
     "req_id": 6,
     "req_method": "PUT",
     "req_path": "/v1/policies/organization",
     "resp_body": "{}\n",
     "resp_bytes": 3,
     "resp_duration": 13.674417,
     "resp_status": 200,
     "time": "2025-06-23T22:58:41Z"
   }
   {
     "client_addr": "172.18.0.4:39134",
     "level": "info",
     "msg": "Received request.",
     "req_body": "{\"input\":{\"type\":\"http\",\"request\":{\"method\":\"GET\",\"host\":\"provider-directory.au.localhost\",\"query\":{\"_id\":\"adv-hearing-care\"},\"headers\":{\"host\":\"provider-directory.au.localhost\",\"user-agent\":\"curl/8.7.1\",\"authorization\":\"Bearer \",\"content-type\":\"application/fhir+json\",\"accept\":\"*/*\"},\"path\":\"/fhir/Organization\",\"port\":9443,\"scheme\":\"https\"},\"var\":{\"server_port\":\"9443\",\"remote_port\":\"61984\",\"timestamp\":1750719539,\"server_addr\":\"172.18.0.4\",\"remote_addr\":\"172.18.0.1\"},\"route\":{\"id\":\"routes#5\",\"name\":\"provider-directory-api-organization-read\",\"status\":1,\"priority\":0,\"plugins\":{\"opa\":{\"with_service\":false,\"with_consumer\":false,\"keepalive\":true,\"keepalive_timeout\":60000,\"host\":\"http://opa:8181\",\"policy\":\"organization/allow\",\"timeout\":3000,\"ssl_verify\":false,\"with_route\":true,\"keepalive_pool\":5}},\"methods\":[\"GET\"],\"upstream_id\":1,\"uri\":\"/fhir/Organi
 zation*\"}}}",
     "req_id": 7,
     "req_method": "POST",
     "req_params": {},
     "req_path": "/v1/data/organization/allow",
     "time": "2025-06-23T22:58:59Z"
   }
   {
     "decision_id": "e880f001-f87a-492f-9432-f97fb9c96e35",
     "input": {
       "request": {
         "headers": {
           "accept": "*/*",
           "authorization": "Bearer ",
           "content-type": "application/fhir+json",
           "host": "provider-directory.au.localhost",
           "user-agent": "curl/8.7.1"
         },
         "host": "provider-directory.au.localhost",
         "method": "GET",
         "path": "/fhir/Organization",
         "port": 9443,
         "query": {
           "_id": "adv-hearing-care"
         },
         "scheme": "https"
       },
       "route": {
         "id": "routes#5",
         "methods": [
           "GET"
         ],
         "name": "provider-directory-api-organization-read",
         "plugins": {
           "opa": {
             "host": "http://opa:8181",
             "keepalive": true,
             "keepalive_pool": 5,
             "keepalive_timeout": 60000,
             "policy": "organization/allow",
             "ssl_verify": false,
             "timeout": 3000,
             "with_consumer": false,
             "with_route": true,
             "with_service": false
           }
         },
         "priority": 0,
         "status": 1,
         "upstream_id": 1,
         "uri": "/fhir/Organization*"
       },
       "type": "http",
       "var": {
         "remote_addr": "172.18.0.1",
         "remote_port": "61984",
         "server_addr": "172.18.0.4",
         "server_port": "9443",
         "timestamp": 1750719539
       }
     },
     "labels": {
       "id": "22821c9e-13a1-42b8-a2bd-41c7c7b156b6",
       "version": "1.5.1"
     },
     "level": "info",
     "metrics": {
       "counter_server_query_cache_hit": 0,
       "timer_rego_external_resolve_ns": 250,
       "timer_rego_input_parse_ns": 735875,
       "timer_rego_query_compile_ns": 551500,
       "timer_rego_query_eval_ns": 367375,
       "timer_server_handler_ns": 2341709
     },
     "msg": "Decision Log",
     "path": "organization/allow",
     "req_id": 7,
     "requested_by": "172.18.0.4:39134",
     "time": "2025-06-23T22:58:59Z",
     "timestamp": "2025-06-23T22:58:59.809873053Z",
     "type": "openpolicyagent.org/decision_logs"
   }
   {
     "client_addr": "172.18.0.4:39134",
     "level": "info",
     "msg": "Sent response.",
     "req_id": 7,
     "req_method": "POST",
     "req_path": "/v1/data/organization/allow",
     "resp_body": "{\"decision_id\":\"e880f001-f87a-492f-9432-f97fb9c96e35\"}\n",
     "resp_bytes": 55,
     "resp_duration": 8.198584,
     "resp_status": 200,
     "time": "2025-06-23T22:58:59Z"
   }
   {
     "headers": {
       "Content-Type": [
         "application/json"
       ],
       "User-Agent": [
         "Open Policy Agent/1.5.1 (linux, arm64)"
       ]
     },
     "level": "debug",
     "method": "POST",
     "msg": "Sending request.",
     "time": "2025-06-23T23:04:19Z",
     "url": "https://telemetry.openpolicyagent.org/v1/version"
   }
   {
     "headers": {
       "Content-Type": [
         "application/json"
       ],
       "User-Agent": [
         "Open Policy Agent/1.5.1 (linux, arm64)"
       ]
     },
     "level": "debug",
     "method": "POST",
     "msg": "Sending request.",
     "time": "2025-06-23T23:04:19Z",
     "url": "https://telemetry.openpolicyagent.org/v1/version"
   }
   {
     "headers": {
       "Content-Length": [
         "213"
       ],
       "Content-Type": [
         "application/json"
       ],
       "Date": [
         "Mon, 23 Jun 2025 23:04:20 GMT"
       ]
     },
     "level": "debug",
     "method": "POST",
     "msg": "Received response.",
     "status": "200 OK",
     "time": "2025-06-23T23:04:20Z",
     "url": "https://telemetry.openpolicyagent.org/v1/version"
   }
   {
     "current_version": "1.5.1",
     "level": "debug",
     "msg": "OPA is up to date.",
     "time": "2025-06-23T23:04:20Z"
   }
   {
     "headers": {
       "Content-Length": [
         "213"
       ],
       "Content-Type": [
         "application/json"
       ],
       "Date": [
         "Mon, 23 Jun 2025 23:04:20 GMT"
       ]
     },
     "level": "debug",
     "method": "POST",
     "msg": "Received response.",
     "status": "200 OK",
     "time": "2025-06-23T23:04:20Z",
     "url": "https://telemetry.openpolicyagent.org/v1/version"
   }
   
   ```
   
   The APISIX logs show the following error:
   
   ```
   2025/06/23 22:58:59 [error] 33#33: *228928 [lua] opa.lua:115: phase_func(): invalid OPA decision format: {"decision_id":"e880f001-f87a-492f-9432-f97fb9c96e35"}
    err: `result` field does not exist, client: 172.18.0.1, server: _, request: "GET /fhir/Organization?_id=adv-hearing-care HTTP/2.0", host: "provider-directory.au.localhost"
   2025/06/23 22:58:59 [warn] 33#33: *228928 [lua] plugin.lua:1210: run_plugin(): opa exits with http status code 503, client: 172.18.0.1, server: _, request: "GET /fhir/Organization?_id=adv-hearing-care HTTP/2.0", host: "provider-directory.au.localhost"
   172.18.0.1 - - [23/Jun/2025:22:58:59 +0000] provider-directory.au.localhost "GET /fhir/Organization?_id=adv-hearing-care HTTP/2.0" 503 269 0.026 "-" "curl/8.7.1" - - - "http://provider-directory.au.localhost"
   ```
   
   Sample project: https://github.com/Robinyo/provider-directory
   
   
   ### Expected Behavior
   
   To evaluate the policy and allow access to the API endpoint.
   
   ### Error Logs
   
   ```
   2025/06/23 22:58:59 [error] 33#33: *228928 [lua] opa.lua:115: phase_func(): invalid OPA decision format: {"decision_id":"e880f001-f87a-492f-9432-f97fb9c96e35"}
    err: `result` field does not exist, client: 172.18.0.1, server: _, request: "GET /fhir/Organization?_id=adv-hearing-care HTTP/2.0", host: "provider-directory.au.localhost"
   2025/06/23 22:58:59 [warn] 33#33: *228928 [lua] plugin.lua:1210: run_plugin(): opa exits with http status code 503, client: 172.18.0.1, server: _, request: "GET /fhir/Organization?_id=adv-hearing-care HTTP/2.0", host: "provider-directory.au.localhost"
   172.18.0.1 - - [23/Jun/2025:22:58:59 +0000] provider-directory.au.localhost "GET /fhir/Organization?_id=adv-hearing-care HTTP/2.0" 503 269 0.026 "-" "curl/8.7.1" - - - "http://provider-directory.au.localhost"
   ```
   
   ### Steps to Reproduce
   
   A sample project, see: https://github.com/Robinyo/provider-directory
   
   ### Environment
   
   - APISIX version - FROM apache/apisix:3.12.0-debian
   - Operating system : Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103 arm64


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12374:
URL: https://github.com/apache/apisix/issues/12374#issuecomment-3976613928

   If there is still a problem, please open it again.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Robinyo (via GitHub)" <gi...@apache.org>.
Robinyo commented on issue #12374:
URL: https://github.com/apache/apisix/issues/12374#issuecomment-2998892885

   With this sample policy:
   
   ```
   package organization
   
   import rego.v1
   
   import input.request
   
   default allow := false
   
   allow if {
   	request.method == "GET"
   }
   ```
   
   I see the following error in the logs:
   
   ```
   apisix                 | 2025/06/24 05:33:40 [error] 35#35: *51054 lua entry thread aborted: runtime error: /usr/local/apisix/apisix/plugins/opa.lua:122: attempt to index local 'result' (a boolean value)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Robinyo (via GitHub)" <gi...@apache.org>.
Robinyo commented on issue #12374:
URL: https://github.com/apache/apisix/issues/12374#issuecomment-2999098239

   > Hi [@Robinyo](https://github.com/Robinyo), what version of OPA are you using?
   
   # FROM openpolicyagent/opa:1.5.1 -> no arm64 platform support
   FROM openpolicyagent/opa:1.5.1-static


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12374:
URL: https://github.com/apache/apisix/issues/12374#issuecomment-3055708969

   Hi @Robinyo, you may have configured the wrong policy, use `organization` instead of `organization/allow`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Robinyo (via GitHub)" <gi...@apache.org>.
Robinyo commented on issue #12374:
URL: https://github.com/apache/apisix/issues/12374#issuecomment-3064211286

   Rego Playground: https://play.openpolicyagent.org/p/Vge3mUTPcX


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Robinyo (via GitHub)" <gi...@apache.org>.
Robinyo commented on issue #12374:
URL: https://github.com/apache/apisix/issues/12374#issuecomment-3064188370

   In the logs OPA is returned 200 (OK) but APISIX is returning 403:
   
   For example:
   
   ```
   opa                    | {
   opa                    |   "client_addr": "172.19.0.4:37546",
   opa                    |   "level": "info",
   opa                    |   "msg": "Received request.",
   opa                    |   "req_body": "{\"input\":{\"request\":{\"headers\":{\"connection\":\"keep-alive\",\"postman-token\":\"08ed1117-9537-4ad7-8b5c-42eb6da97f5c\",\"content-type\":\"application/json\",\"accept-encoding\":\"gzip, deflate, br\",\"cache-control\":\"no-cache\",\"user-agent\":\"PostmanRuntime/7.44.1\",\"accept\":\"*/*\",\"host\":\"provider-directory.au.localhost\"},\"query\":{\"_id\":\"adv-hearing-care\"},\"port\":9443,\"path\":\"/fhir/Organization\",\"scheme\":\"https\",\"method\":\"GET\",\"host\":\"provider-directory.au.localhost\"},\"var\":{\"server_addr\":\"172.19.0.4\",\"remote_addr\":\"172.19.0.1\",\"server_port\":\"9443\",\"remote_port\":\"56522\",\"timestamp\":1752274853},\"type\":\"http\"}}",
   opa                    |   "req_id": 36,
   opa                    |   "req_method": "POST",
   opa                    |   "req_params": {},
   opa                    |   "req_path": "/v1/data/organization",
   opa                    |   "time": "2025-07-11T23:00:53Z"
   opa                    | }
   opa                    | {
   opa                    |   "decision_id": "97dc5c0e-2d06-478e-9afa-9088b2c4bc66",
   opa                    |   "input": {
   opa                    |     "request": {
   opa                    |       "headers": {
   opa                    |         "accept": "*/*",
   opa                    |         "accept-encoding": "gzip, deflate, br",
   opa                    |         "cache-control": "no-cache",
   opa                    |         "connection": "keep-alive",
   opa                    |         "content-type": "application/json",
   opa                    |         "host": "provider-directory.au.localhost",
   opa                    |         "postman-token": "08ed1117-9537-4ad7-8b5c-42eb6da97f5c",
   opa                    |         "user-agent": "PostmanRuntime/7.44.1"
   opa                    |       },
   opa                    |       "host": "provider-directory.au.localhost",
   opa                    |       "method": "GET",
   opa                    |       "path": "/fhir/Organization",
   opa                    |       "port": 9443,
   opa                    |       "query": {
   opa                    |         "_id": "adv-hearing-care"
   opa                    |       },
   opa                    |       "scheme": "https"
   opa                    |     },
   opa                    |     "type": "http",
   opa                    |     "var": {
   opa                    |       "remote_addr": "172.19.0.1",
   opa                    |       "remote_port": "56522",
   opa                    |       "server_addr": "172.19.0.4",
   opa                    |       "server_port": "9443",
   opa                    |       "timestamp": 1752274853
   opa                    |     }
   opa                    |   },
   opa                    |   "labels": {
   opa                    |     "id": "a64fad56-c5b3-40d6-b6be-99cd3d80ff06",
   opa                    |     "version": "1.5.1"
   opa                    |   },
   opa                    |   "level": "info",
   opa                    |   "metrics": {
   opa                    |     "counter_server_query_cache_hit": 1,
   opa                    |     "timer_rego_external_resolve_ns": 250,
   opa                    |     "timer_rego_input_parse_ns": 664583,
   opa                    |     "timer_rego_query_eval_ns": 489209,
   opa                    |     "timer_server_handler_ns": 1644667
   opa                    |   },
   opa                    |   "msg": "Decision Log",
   opa                    |   "path": "organization",
   opa                    |   "req_id": 36,
   opa                    |   "requested_by": "172.19.0.4:37546",
   opa                    |   "result": {
   opa                    |     "request": {
   opa                    |       "method": "GET"
   opa                    |     },
   opa                    |     "result": {
   opa                    |       "allow": true,
   opa                    |       "reason": "request.method == GET"
   opa                    |     }
   opa                    |   },
   opa                    |   "time": "2025-07-11T23:00:53Z",
   opa                    |   "timestamp": "2025-07-11T23:00:53.903028339Z",
   opa                    |   "type": "openpolicyagent.org/decision_logs"
   opa                    | }
   opa                    | {
   opa                    |   "client_addr": "172.19.0.4:37546",
   opa                    |   "level": "info",
   opa                    |   "msg": "Sent response.",
   opa                    |   "req_id": 36,
   opa                    |   "req_method": "POST",
   opa                    |   "req_path": "/v1/data/organization",
   opa                    |   "resp_body": "{\"decision_id\":\"97dc5c0e-2d06-478e-9afa-9088b2c4bc66\",\"result\":{\"request\":{\"method\":\"GET\"},\"result\":{\"allow\":true,\"reason\":\"request.method == GET\"}}}\n",
   opa                    |   "resp_bytes": 150,
   opa                    |   "resp_duration": 4.565958,
   opa                    |   "resp_status": 200,
   opa                    |   "time": "2025-07-11T23:00:53Z"
   opa                    | }
   apisix                 | 172.19.0.1 - - [11/Jul/2025:23:00:53 +0000] provider-directory.au.localhost "GET /fhir/Organization?_id=adv-hearing-care HTTP/1.1" 403 225 0.021 "-" "PostmanRuntime/7.44.1" - - - "http://provider-directory.au.localhost"
   keycloak.au.localhost  | 2025-07-11 23:01:03,710 TRACE [io.vertx.ext.web.impl.RouterImpl] (vert.x-eventloop-thread-7) Router: 192775273 accepting request GET https://hapi-fhir.au.localhost:9000/health/ready
   ```
   
   apisix-standalone.yml
   
   ```
     - name: provider-directory-api-organization-read
       uri: /fhir/Organization*
       methods: [ "GET" ]
       upstream_id: 1
       plugins:
         opa:
           host: "http://opa:8181"
           policy: "organization"
   ```
   
   policy
   
   ```
   package organization
   
   import rego.v1
   
   import input.request
   
   result := {
       "allow": true,
       "reason": "request.method == GET",
   } if {
   	request.method == "GET"
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12374:
URL: https://github.com/apache/apisix/issues/12374#issuecomment-2999014833

   Hi @Robinyo, what version of OPA are you using?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop commented on issue #12374:
URL: https://github.com/apache/apisix/issues/12374#issuecomment-3520247936

   APISIX's OPA plugin only requires OPA to return a decision result with a `result` field. However, the current configuration requests `/v1/data/organization/allow`, but there's no corresponding `allow` rule outputting a `result`, causing the response format to not meet the plugin's expectations. The plugin itself is working correctly. Adjusting the policy path or adding the `allow` rule will restore normal functionality.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Robinyo (via GitHub)" <gi...@apache.org>.
Robinyo commented on issue #12374:
URL: https://github.com/apache/apisix/issues/12374#issuecomment-3064620670

   Success :)
   
   Sample policy:
   
   ```
   package organization
   
   import rego.v1
   
   import input.request
   
   default allow := false
   
   allow if {
   	request.method == "GET"
   }
   ```
   
   Sample input:
   
   ```
   {
     "request": {
       "method": "GET"
     }
   }
   ```
   
   Sample output:
   
   ```
   {
       "allow": true
   }
   ```
   Logs:
   
   ```
   {
   opa                    |   "client_addr": "172.19.0.4:34652",
   opa                    |   "level": "info",
   opa                    |   "msg": "Received request.",
   opa                    |   "req_body": "{\"input\":{\"request\":{\"headers\":{\"accept\":\"*/*\",\"user-agent\":\"curl/8.7.1\",\"content-type\":\"application/fhir+json\",\"host\":\"provider-directory.au.localhost\"},\"query\":{\"_id\":\"adv-hearing-care\"},\"port\":9443,\"path\":\"/fhir/Organization\",\"scheme\":\"https\",\"method\":\"GET\",\"host\":\"provider-directory.au.localhost\"},\"var\":{\"server_addr\":\"172.19.0.4\",\"remote_addr\":\"172.19.0.1\",\"server_port\":\"9443\",\"remote_port\":\"55502\",\"timestamp\":1752291648},\"type\":\"http\"}}",
   opa                    |   "req_id": 49,
   opa                    |   "req_method": "POST",
   opa                    |   "req_params": {},
   opa                    |   "req_path": "/v1/data/organization",
   opa                    |   "time": "2025-07-12T03:40:48Z"
   opa                    | }
   opa                    | {
   opa                    |   "decision_id": "5c536793-05a6-4647-8894-2e94c9316a23",
   opa                    |   "input": {
   opa                    |     "request": {
   opa                    |       "headers": {
   opa                    |         "accept": "*/*",
   opa                    |         "content-type": "application/fhir+json",
   opa                    |         "host": "provider-directory.au.localhost",
   opa                    |         "user-agent": "curl/8.7.1"
   opa                    |       },
   opa                    |       "host": "provider-directory.au.localhost",
   opa                    |       "method": "GET",
   opa                    |       "path": "/fhir/Organization",
   opa                    |       "port": 9443,
   opa                    |       "query": {
   opa                    |         "_id": "adv-hearing-care"
   opa                    |       },
   opa                    |       "scheme": "https"
   opa                    |     },
   opa                    |     "type": "http",
   opa                    |     "var": {
   opa                    |       "remote_addr": "172.19.0.1",
   opa                    |       "remote_port": "55502",
   opa                    |       "server_addr": "172.19.0.4",
   opa                    |       "server_port": "9443",
   opa                    |       "timestamp": 1752291648
   opa                    |     }
   opa                    |   },
   opa                    |   "labels": {
   opa                    |     "id": "a64fad56-c5b3-40d6-b6be-99cd3d80ff06",
   opa                    |     "version": "1.5.1"
   opa                    |   },
   opa                    |   "level": "info",
   opa                    |   "metrics": {
   opa                    |     "counter_server_query_cache_hit": 1,
   opa                    |     "timer_rego_external_resolve_ns": 333,
   opa                    |     "timer_rego_input_parse_ns": 1707500,
   opa                    |     "timer_rego_query_eval_ns": 598667,
   opa                    |     "timer_server_handler_ns": 3228333
   opa                    |   },
   opa                    |   "msg": "Decision Log",
   opa                    |   "path": "organization",
   opa                    |   "req_id": 49,
   opa                    |   "requested_by": "172.19.0.4:34652",
   opa                    |   "result": {
   opa                    |     "allow": true,
   opa                    |     "request": {
   opa                    |       "method": "GET"
   opa                    |     }
   opa                    |   },
   opa                    |   "time": "2025-07-12T03:40:48Z",
   opa                    |   "timestamp": "2025-07-12T03:40:48.570314459Z",
   opa                    |   "type": "openpolicyagent.org/decision_logs"
   opa                    | }
   opa                    | {
   opa                    |   "client_addr": "172.19.0.4:34652",
   opa                    |   "level": "info",
   opa                    |   "msg": "Sent response.",
   opa                    |   "req_id": 49,
   opa                    |   "req_method": "POST",
   opa                    |   "req_path": "/v1/data/organization",
   opa                    |   "resp_body": "{\"decision_id\":\"5c536793-05a6-4647-8894-2e94c9316a23\",\"result\":{\"allow\":true,\"request\":{\"method\":\"GET\"}}}\n",
   opa                    |   "resp_bytes": 106,
   opa                    |   "resp_duration": 9.179417,
   opa                    |   "resp_status": 200,
   opa                    |   "time": "2025-07-12T03:40:48Z"
   opa                    | }
   provider-directory     | 2025-07-12T03:40:49.644Z  INFO 1 --- [nio-8080-exec-3] fhirtest.access                          : Path[/fhir] Source[172.19.0.1] Operation[search-type  Organization] UA[curl/8.7.1] Params[?_id=adv-hearing-care] ResponseEncoding[JSON] Operation[search-type  Organization] UA[curl/8.7.1] Params[?_id=adv-hearing-care] ResponseEncoding[JSON]
   keycloak.au.localhost  | 2025-07-12 03:40:52,312 TRACE [io.vertx.ext.web.impl.RouterImpl] (vert.x-eventloop-thread-7) Router: 192775273 accepting request GET https://hapi-fhir.au.localhost:9000/health/ready
   apisix                 | 172.19.0.1 - - [12/Jul/2025:03:40:49 +0000] provider-directory.au.localhost "GET /fhir/Organization?_id=adv-hearing-care HTTP/2.0" 200 1306 1.101 "-" "curl/8.7.1" 172.19.0.8:8080 200 1.067 "http://provider-directory.au.localhost"
   ```
   
   Request:
   
   ```
   curl -X GET https://provider-directory.au.localhost/fhir/Organization\?_id\=adv-hearing-care \
     -H 'Content-Type: application/json'
   ```
   
   Response:
   
   ```
   {
     "resourceType": "Bundle",
     "id": "b8afd76e-a539-43d8-aed2-c8aff38171f9",
     "meta": {
       "lastUpdated": "2025-07-12T03:40:48.902+00:00"
     },
     "type": "searchset",
     "total": 1,
     "link": [ {
       "relation": "self",
       "url": "https://provider-directory.au.localhost/fhir/Organization?_id=adv-hearing-care"
     } ],
     "entry": [ {
       "fullUrl": "https://provider-directory.au.localhost/fhir/Organization/adv-hearing-care",
       "resource": {
         "resourceType": "Organization",
         "id": "adv-hearing-care",
         "meta": {
           "versionId": "1",
           "lastUpdated": "2025-06-24T05:23:52.937+00:00",
           "source": "#oBeaQFRaT1Y5sSyi",
           "profile": [ "http://hl7.org.au/fhir/core/StructureDefinition/au-core-organization" ]
         },
         "identifier": [ {
           "type": {
             "coding": [ {
               "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
               "code": "XX"
             } ],
             "text": "ABN"
           },
           "system": "http://hl7.org.au/id/abn",
           "value": "12345678901"
         } ],
         "active": true,
         "name": "Audiology Advanced Hearing Care",
         "telecom": [ {
           "system": "email",
           "value": "info@ahc.example.com",
           "use": "work"
         } ]
       },
       "search": {
         "mode": "match"
       }
     } ]
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Baoyuantop (via GitHub)" <gi...@apache.org>.
Baoyuantop closed issue #12374: bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist
URL: https://github.com/apache/apisix/issues/12374


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] bug: OPA plugin - invalid OPA decision format - err: `result` field does not exist [apisix]

Posted by "Robinyo (via GitHub)" <gi...@apache.org>.
Robinyo commented on issue #12374:
URL: https://github.com/apache/apisix/issues/12374#issuecomment-3064194557

   If I execute a  simply query:
   
   ```
   curl --location 'https://provider-directory.au.localhost/v1/data/organization' \
   --header 'Content-Type: application/json' \
   --data '{
       "request": {
           "method": "GET"
       }
   }'
   ```
   
   Response 200 (OK):
   
   ```
   {
       "decision_id": "dece0d6d-d67d-478b-a500-46b4615b0a99",
       "result": {
           "request": {
               "method": "GET"
           }
       },
       "warning": {
           "code": "api_usage_warning",
           "message": "'input' key missing from the request"
       }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org