[Google] 500 Error on translate-request
Image: community.opengroup.org:5555/osdu/platform/security-and-compliance/policy/gc-policy:a95f97b0
We send this request:
curl --location --request POST 'https://<host>/api/policy/v1/translate' \
--header 'data-partition-id: osdu' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
"input": {
"groups": [
"data.ihs.viewers@osdu.osdu-gcp.go3-nrg.projects.epam.com",
"data.newyest.owners@osdu.osdu-gcp.go3-nrg.projects.epam.com",
"data.default.viewers@osdu.osdu-gcp.go3-nrg.projects.epam.com",
"data.deletion-test1.test@osdu.osdu-gcp.go3-nrg.projects.epam.com",
"data.wke.owners@osdu.osdu-gcp.go3-nrg.projects.epam.com",
"data.certification35510.viewers@osdu.osdu-gcp.go3-nrg.projects.epam.com",
"data.integration.test@osdu.osdu-gcp.go3-nrg.projects.epam.com",
"data.wke.viewers@osdu.osdu-gcp.go3-nrg.projects.epam.com",
"data.default.owners@osdu.osdu-gcp.go3-nrg.projects.epam.com",
"data.test1@osdu.osdu-gcp.go3-nrg.projects.epam.com"
],
"operation": "view"
},
"unknowns": [
"input.record"
],
"query": "data.osdu.instance.search.allow \u003d\u003d true"
}'
And we get the following error in the service:
"Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 366, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/fastapi/applications.py", line 269, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/applications.py", line 124, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.9/site-packages/starlette/middleware/cors.py", line 84, in __call__
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 93, in __call__
raise exc
File "/usr/local/lib/python3.9/site-packages/starlette/exceptions.py", line 82, in __call__
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "/usr/local/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 670, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 266, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.9/site-packages/starlette/routing.py", line 65, in app
response = await func(request)
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 227, in app
raw_response = await run_endpoint_function(
File "/usr/local/lib/python3.9/site-packages/fastapi/routing.py", line 160, in run_endpoint_function
return await dependant.call(**values)
File "/opt/./api/translate_api.py", line 49, in translate_policy
opa_response = opa.compile(query=json.dumps(posted_data), name="compile api for translate")
File "/opt/./opa.py", line 137, in compile
t.stop()
File "/opt/./timer.py", line 43, in stop
self.logger.info(self.textwithname.format(self.name, elapsed_time))
AttributeError: 'function' object has no attribute 'info'"
It seems that the root of the error is here:
Edited by Yan Sushchynski (EPAM)