Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: public API endpoint for listing folder content returns 500 error in some cases #249

Closed
tilorspace opened this issue Jan 29, 2025 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tilorspace
Copy link
Contributor

Bug Description

It happens when owner of the shared folder is querying its content through /api/v1/folder/tree endpoint, and I think additional condition is that parent folder (e.g. group’s shared folder) is created by somebody else (i.e. a group PI).

Error stack from a production clone:

INFO 24 Jan 2025 08:42:24,008 - LoggingInterceptor.preHandle | [/app/api/v1/folders/tree/{redacted}] from 132.229.92.105 with args: [orderBy=lastModified desc,pageNumber=0,pageSize=20,] made by: [null]
ERROR 24 Jan 2025 08:42:24,803 - RestControllerAdvice.handle500Error | error
java.util.NoSuchElementException: No value present
        at java.base/java.util.Optional.get(Optional.java:143) ~[?:?]
        at com.researchspace.api.v1.model.RecordTreeItemInfo.<init>(RecordTreeItemInfo.java:58) ~[classes/:?]
        at com.researchspace.api.v1.controller.FolderApiController.lambda$doListing$4(FolderApiController.java:196) ~[classes/:?]
        at com.researchspace.api.v1.controller.BaseApiController.convertISearchResults(BaseApiController.java:175) ~[classes/:?]
        at com.researchspace.api.v1.controller.FolderApiController.doListing(FolderApiController.java:189) ~[classes/:?]
        at com.researchspace.api.v1.controller.FolderApiController.folderTreeById(FolderApiController.java:155) ~[classes/:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

Error stack from a testing server:

INFO 24 Jan 2025 09:53:32,271 - APIRequestThrottlingInterceptor.isInventoryRequest | request URI is /app/api/v1/folders/tree/25561
INFO 24 Jan 2025 09:53:32,486 - AbstractApiAuthenticator.authenticate | Reusing the current session for API authentication, principal={redacted}
INFO 24 Jan 2025 09:53:32,489 - AnalyticsManagerImpl.returnIfUserNull | user  is com.researchspace.model.User@7271c35c[username=matthias2,enabled=true,accountExpired=false,credentialsExpired=false,accountLocked=false,Roles: ,Role [name=ROLE_USER, description=Default role for all Users]] - id is 1966080
INFO 24 Jan 2025 09:53:32,489 - AnalyticsManagerImpl.getAnalyticsUserId | Generated user id of 1966080@metvocbpai
INFO 24 Jan 2025 09:53:32,874 - RestControllerAdvice.logException | java.util.NoSuchElementException
ERROR 24 Jan 2025 09:53:32,874 - RestControllerAdvice.handle500Error | error
java.util.NoSuchElementException: No value present
        at java.base/java.util.Optional.get(Optional.java:143) ~[?:?]
        at com.researchspace.api.v1.model.RecordTreeItemInfo.<init>(RecordTreeItemInfo.java:58) ~[classes/:?]
        at com.researchspace.api.v1.controller.FolderApiController.lambda$doListing$4(FolderApiController.java:196) ~[classes/:?]
        at com.researchspace.api.v1.controller.BaseApiController.convertISearchResults(BaseApiController.java:175) ~[classes/:?]
        at com.researchspace.api.v1.controller.FolderApiController.doListing(FolderApiController.java:189) ~[classes/:?]
        at com.researchspace.api.v1.controller.FolderApiController.folderTreeById(FolderApiController.java:155) ~[classes/:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

Steps to Reproduce

It happens when owner of the shared folder is querying its content through /api/v1/folder/tree endpoint, and I think additional condition is that parent folder (e.g. group’s shared folder) is created by somebody else (i.e. a group PI).

Expected Behavior

.

Screenshots

No response

Which RSpace version did you encounter the bug with?

1.106

Mobile / Desktop

Mobile

Operating system

Browser

Browser version

Additional Context

No response

@tilorspace tilorspace added the bug Something isn't working label Jan 29, 2025
@tilorspace tilorspace self-assigned this Jan 29, 2025
@tilorspace tilorspace moved this from Triage to Unprioritised in 👷 RSpace development Jan 29, 2025
@tilorspace tilorspace removed their assignment Jan 29, 2025
@mKowalski256 mKowalski256 added this to the RSpace 2.7.0 milestone Feb 3, 2025
@mKowalski256 mKowalski256 self-assigned this Feb 4, 2025
@tilorspace tilorspace moved this from Unprioritised to In Progress in 👷 RSpace development Feb 5, 2025
@tilorspace tilorspace moved this from In Progress to Done in 👷 RSpace development Feb 11, 2025
@tilorspace tilorspace closed this as completed by moving to Done in 👷 RSpace development Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

No branches or pull requests

2 participants