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

MergeRequestApi getDiffs() returns 500 Internal Server Error #1110

Open
sjyzheng opened this issue Apr 2, 2024 · 2 comments
Open

MergeRequestApi getDiffs() returns 500 Internal Server Error #1110

sjyzheng opened this issue Apr 2, 2024 · 2 comments

Comments

@sjyzheng
Copy link

sjyzheng commented Apr 2, 2024

Hi team, I am trying to use the MergeRequestApi getDiffs to retrieve the MR diff.
val mergeRequestDiff = api.mergeRequestApi.getDiffs(projectID, mergeRequestIId)
It returns 500 Internal Server Error.
org.gitlab4j.api.GitLabApiException: 500 Internal Server Error at org.gitlab4j.api.AbstractApi.validate(AbstractApi.java:678) at org.gitlab4j.api.AbstractApi.get(AbstractApi.java:214) at org.gitlab4j.api.Pager.<init>(Pager.java:92) at org.gitlab4j.api.MergeRequestApi.getDiffs(MergeRequestApi.java:591) at org.gitlab4j.api.MergeRequestApi.getDiffs(MergeRequestApi.java:575) at com.indeed.pqp.service.daemon.util.LanguageHelper.getDiffFilePath(LanguageHelper.kt:25) at com.indeed.pqp.service.daemon.util.LanguageHelperTest.get changed file languages(LanguageHelperTest.kt:18) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

I tried to use Postman to call the API https://code.xxx.com/api/v4/projects/123/merge_requests/1/diffs, and it worked as expected. Can someone help me take a look? Thanks!

@jmini
Copy link
Collaborator

jmini commented Apr 12, 2024

If the request works with Postman, what you can try to do is to enable logging of HTTP request/response to understand what is going on.

Here is how:

new GitLabApi(..., ....)
            .withRequestResponseLogging(Level.INFO);

This way you might be able to compare with what you are sending from Postman and why the GitLab server answers with 500.

@iwangjie
Copy link

If I add itemsPerPage, it doesn't produce 500.

To be precise: org.gitlab4j.api.MergeRequestApi#getDiffs(java.lang.Object, java.lang.Long, int) ,it's ok!
But: org.gitlab4j.api.MergeRequestApi#getDiffs(java.lang.Object, java.lang.Long) , Probably because of the default 96, the error is generated?
image

After my trial and error, if itemsPerPage is more than 30, it produces error 500. If it is less than or equal to 30, it produces 200.

Hopefully, this result will help fix the error!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants