-
Notifications
You must be signed in to change notification settings - Fork 563
Could not resolve repository metadata error - 500 for profile endpoints #2014
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
Comments
Can you enable debug logging or provide a stack trace by other means so that we understand what's causing the issue? |
Hi. Thank you for replying @mp911de . I have now enabled debug logging and will attach the stacktrace when the error happens again. For now, I am attaching the normal error logs sdr_logs.txt As of now, there are no users using this instance of the application. I have a healthcheck script running every 10 mins which tries to hit the profile endpoint of Customer, AppTwitter and CustomerTwitter . Attached file contains the stacktrace when the profile endpoint failed for Customer and AppTwitter. I will get back to you soon with the debug logs as and when I notice an error. |
I am afraid I'm not really able to get to the bottom of this without some project to play with. It's not clear what the request looks like for the stack trace. What puzzles me is that apparently a What also generally looks problematic is that literally every entity is backed by a repository including bi-directional relationships between those entities. It's very easy to get these wrong, e.g. by not properly updating the back-reference in the setter for a related entity and thus, depending on which side you're updating, you might see the opposite side not updating properly. That in turn might then cause 404s for instances that failed to be created due to the mapping issues. We generally recommend to avoid bi-directional relationships and proper aggregate modeling. Not because SD REST doesn't work in a scenario like described above, but the likelihood of user code missing a tiny piece and that causing the program to fail. Another aspect is API purity. If you model bi-directional aggregate relationships, which side do you update references from? |
Thank you @odrotbohm for your response. I will create a sample project and will update soon. As I mentioned earlier, this application is in an instance which is not used right now (except for the health checks hitting the profile endpoints). I have attached the debug logs for the same where the /profile/{entity} returns error Regarding bi-directional relationships, point noted. The use-case required that all of these entities to be backed by repositories. But I understand that this could be a problem. I will see if I can model it better. |
This issue is similar to #1729 .
Our app works as expected most of the time but occasionally we get a 404 error for some of our API endpoints.
When we check the /profile endpoint for that repository, it returns 500 with
"Could not resolve repository metadata"
It works after a restart but then fails again after a while.
We use Spring-boot-starter-data-rest : 2.2.6.RELEASE
Example UseCase :
3 Entities :
A
Customer
can have multiple twitter Accounts (CustomerTwitter
). One Twitter App(AppTwitter
) can be used to handle multiple CustomersAll of these entities have been exposed as repositories
Entites:
Customer.java
AppTwitter.java
CustomerTwitter.java
Repositories
CustomerRepository.java
AppTwitterRepository.java
CustomerTwitterRepository.java
Sometimes making a GET call to any one of these endpoints returns 404 error and the /profile endpoint gives 500 error with Could not resolve repository metadata
Weird thing is this happens once every 6-7 hours and almost never happens in my local environment to even figure out and debug the issue.
The text was updated successfully, but these errors were encountered: