avniproject / avni-server

Backend APIs for Avni
https://avniproject.org
GNU Affero General Public License v3.0
7 stars 25 forks source link

Unable to create user with identifier prefix #740

Closed mahalakshme closed 2 months ago

mahalakshme commented 3 months ago

Steps to reproduce:

Server error logs:

2024-07-01 10:17:37.435  INFO 487 --- [http-nio-8021-exec-440] org.avni.server.web.UserController       : Creating user with username 'zz@jscs' and UUID '892f4be8-9fc7-477c-b8cc-258e0ec57b20'
2024-07-01 10:17:37.445 ERROR 487 --- [http-nio-8021-exec-440] org.avni.server.util.BugsnagReporter     : null

java.lang.NullPointerException: null
    at org.avni.server.service.UserService.save(UserService.java:55)
    at org.avni.server.service.UserService$$FastClassBySpringCGLIB$$fb3fa85a.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:685)
    at org.avni.server.service.UserService$$EnhancerBySpringCGLIB$$f6a6399b.save(<generated>)
    at org.avni.server.web.UserController.createUser(UserController.java:104)
    at org.avni.server.web.UserController$$FastClassBySpringCGLIB$$6bdc90d8.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:747)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
    at org.avni.server.web.UserController$$EnhancerBySpringCGLIB$$245b31d5.createUser(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:870)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:776)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)

Expected:

Should be able to create user with a new identifier prefix unless there exists a different user with the same prefix during which an error will be shown like "There is another user {username} with same prefix: {idPrefix}"

AchalaBelokar commented 2 months ago