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

Version 2.10, REST API, POST new file, Error 500 #1748

Closed
ebors-sysnetcz opened this issue Oct 25, 2023 · 9 comments · Fixed by #1804
Closed

Version 2.10, REST API, POST new file, Error 500 #1748

ebors-sysnetcz opened this issue Oct 25, 2023 · 9 comments · Fixed by #1804
Assignees
Labels
bug For confirmed bugs component:rest

Comments

@ebors-sysnetcz
Copy link

Describe the bug

Using the latest version, 2.10. Application is running.
Using POST Man as client, with the correct setting like in screenshot, i have got the error 500.
The method uploadToDocumentService is called according to the log, but no more information.

Logs

2023-10-25 22:52:32 20:52:32,151 DEBUG [f.p.e.c.f.r.RestApi] uploadToDocumentService(true, null, null, null, ...)

Expected behavior

An file should be uploaded to the app to be processed.

Versions:

  • Windows 11
  • Docker (Desktop)
  • Running the app as container
  • Version 2.10 (latest)

Attachment

Screenshot of the POSTMAN calling
Snímek obrazovky 2023-10-25 225452
Snímek obrazovky 2023-10-25 225507

@ebors-sysnetcz ebors-sysnetcz added the check_for_bug Needs to be reproduced label Oct 25, 2023
@ebors-sysnetcz
Copy link
Author

Added info, that with curl it is working

image

@dadoonet
Copy link
Owner

Do you think that POSTMAN could mimic how curl is sending the request?
Or what is your suggestion for a code change?

@ebors-sysnetcz
Copy link
Author

Yes, i will figure it out, and make the suggestion of the change. I will try to fork the project to the local and test with postman.

@ebors-sysnetcz
Copy link
Author

Im not so familiar with grizzly2 web server, but its possible to see, what the request is incomming from outside (like log setting)? Or just to see more info in log, like exceptions, in the DocumentApi class method uploadToDocumentService ?

@dadoonet
Copy link
Owner

I think you can probably change the log level for those classes. Hopefully they are tracing everything.

@ebors-sysnetcz
Copy link
Author

I have some news, i have tried from another module to use the Spring Rest API Client = WebTestClient, and the the REST API on the fscrawler its working very nice, i can upload with this way the attachments to process. So its a question, if needed to debug the communication with POSTMAN.

The other nice to have could be the authentication of the REST API, with some API-KEY.

@fg-uulm
Copy link

fg-uulm commented Dec 7, 2023

I experienced the same behaviour, and traced it back by using Wireshark to compare the http requests to the name of the multipart part - if using anything else than "file" for the part I also get an error 500. With the name being "file" and unaltered settings, it seems to work. See attached wireshark screenshot and postman screenshot for reference for a working request.

image
image

@dadoonet
Copy link
Owner

dadoonet commented Dec 7, 2023

Amazing!

So basically, I should "just" check that file is not empty and send a proper error message instead, I guess.

@dadoonet
Copy link
Owner

dadoonet commented Dec 7, 2023

The other nice to have could be the authentication of the REST API, with some API-KEY.

Agreed. That'd be great to use Elasticsearch keys for that.

dadoonet added a commit that referenced this issue Jan 16, 2024
Instead of producing a NPE, we now catch the problem (using the wrong field name `file` and return a proper error message.

Closes #1748.
@dadoonet dadoonet added bug For confirmed bugs component:rest and removed check_for_bug Needs to be reproduced labels Jan 16, 2024
@dadoonet dadoonet self-assigned this Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug For confirmed bugs component:rest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants