-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
500 Internal Server Error while using Admin REST API #181
Comments
That's strange indeed. Would it be possible for you to share the full script? Meanwhile, a few things to try, would be glad to see the effect on your issue:
|
Fief log output:
I see, that each time, when the problem doesn't occur, both 'Start task' and 'Done task' are executed before the next request arrives. The opposite is also true: when the 500 occurs, web hooks appear in the log after one or more following requests. This makes me thinking that there is, probably, some kind of deferred web hook trigger, which doesn't handle properly the case, when many requests arrive one after another. 500 most likely means some exception inside Fief, but log output doesn't show it. I would capture the Exception stack trace as well, if you'll tell me how to enable it. |
I was able to reproduce it (especially when creating users, not when creating permissions). Here is the error I got:
It seems there is a lock on the SQLite database, probably because several processes try to access it concurrently. I'll try to see what can be done about it. |
I was able to track down the problem: it comes from the My intuition is that, sometimes, when a subsequent request comes to create a user/permission, the AuditLog from the previous request is currently being written to the DB, which raises the database lock error. I'll see how to mitigate this. Maybe by deferring the AuditLogger completely in the background worker. |
The bug still exists, but is only less frequent now. I'd suggest reopening the bug and investigating it further, GitHub doesn't allow me to reopen it. |
I am getting a similar error I think just trying to login to admin now -- I was recently able to login though, still trying to debug it at the moment. |
Describe the bug
Fief responds with "500 Internal Server Error" while using different Admin REST API from a script.
To Reproduce
Steps to reproduce the behavior:
Assuming that requests have all needed and correct POST payloads, headers and Authorization Bearer.
Expected behavior
No "500 Internal server error" responses from Fief.
Configuration
self-hosted, Fief version: 0.24.2
Additional context
The error is non-deterministic, it's not related to any particular request, any request can return 500.
When I added 1 second delay between requests, everything went OK. You can see the successful log below.
Without delays, however, I could not execute my script fully, not getting 500 at some of the requests. The log in this case looks like this:
It looks like, there is a race related to webhooks somewhere.
The text was updated successfully, but these errors were encountered: