ego
ego copied to clipboard
BUG - Internal Server Error when Admin user self issues API Key
This happened following the swagger docs in virusseq-dataportal for issuing an API Key:
Basic auth worked, but this failed when @lepsalex as an admin user tried to issue himself an API Key with a Bearer token.
2021-04-07 01:07:45,544 [http-nio-8081-exec-7] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: A different object with the same identifier value was already associated with the session : [bio.overture.ego.model.entity.ApiKeyScope#VIRUS-SEQ.READ]; nested exception is javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [bio.overture.ego.model.entity.ApiKeyScope#VIRUS-SEQ.READ]] with root cause
javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [bio.overture.ego.model.entity.ApiKeyScope#VIRUS-SEQ.READ]
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:123)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
The exact step were (all using the EGO Swagger UI):
- Authorize with token (but forgot to add
Beareras I thought it was implicit given the verbiage on the swagger-ui) - Send request for apiKey
/api/o/api_key - Request invalid due to bad auth?
- Add
Bearerto auth and try again - 500 error (logs as above)