bcgov / bcgov/entity

AUTH-API - Error on org get

Open
#15,904 0 comments 0 reactions 0 assignees View on GitHub
bug Dev
Dominant language
JavaScript
Stars
23
Forks
62
Avg merge
24m
Merged PRs (30d)
1

Description

```
2023-04-03 19:46:24,680 - auth_api - ERROR in app:app.py:1891 - log_exception: Exception on /api/v1/orgs [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.8/site-packages/flask_restx/api.py", line 404, in wrapper
resp = resource(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/flask/views.py", line 89, in view
return self.dispatch_request(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/flask_restx/resource.py", line 46, in dispatch_request
resp = meth(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/flask_opentracing/tracing.py", line 82, in wrapper
r = f(*args, **kwargs)
File "/usr/local/lib/python3.8/site-packages/flask_restx/cors.py", line 42, in wrapped_function
resp = make_response(f(*args, **kwargs))
File "/usr/local/lib/python3.8/site-packages/flask_jwt_oidc/jwt_manager.py", line 224, in wrapper
return f(*args, **kwargs)
File "/opt/app-root/src/auth_api/resources/org.py", line 106, in get
response, status = OrgService.search_orgs(org_search), http_status.HTTP_200_OK
File "/opt/app-root/src/auth_api/services/org.py", line 711, in search_orgs
search.access_type, is_staff_admin = Org.refine_access_type(search.access_type)
File "/opt/app-root/src/auth_api/utils/user_context.py", line 134, in wrapper
return function(*func_args, **func_kwargs)
File "/opt/app-root/src/auth_api/services/org.py", line 746, in refine_access_type
access_types.remove(AccessType.ANONYMOUS.value)
ValueError: list.remove(x): x not in list
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing GET /api/v1/orgs and read auth_api/resources/org.py, auth_api/services/org.py, and auth_api/utils/user_context.py around the traceback locations. Trace refine_access_type and determine the request state that causes the ValueError; done means the endpoint no longer raises this exception and its response behavior is verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.