After having logged out and logged in again on staging, I get:
Access to fetch at 'https://api.test-paris.happy-dev.fr/users/' from origin 'https://test-paris.happy-dev.fr' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Designs
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
For some reason I think this occurs when there is another serverside error.. do you have a 500 or something before it in the console/network? Or in the server logs?
Indeed. This was a user with username http://localhost:8000/users/admin/ and slug http://localhost:8000/users/admin/. The slug field is what caused the problem. This user got created somehow yesterday. Probably not using the Django admin (which had no history on that object).
The user has been deleted now. The page has returned to normal.
We have no clue as to how this particular user got created...
By Christophe Henry on 2019-11-22T14:53:53 (imported from GitLab project)
The problem is reproductible by creating a user in Django admin and then modify the DB by hand to put http://localhost:8000/users/admin/ in the user and slug fields. This causes the error:
NoReverseMatch at /users/Reverse for 'ldpuser-detail' with keyword arguments '{'slug': 'http://localhost:8000/users/admin/'}' not found. 1 pattern(s) tried: ['users/(?P<slug>[\\w\\-\\.]+)/$']
which is the error that was logged on test-paris' server.
By Christophe Henry on 2019-11-22T15:00:42 (imported from GitLab project)
@christophehenry, @jbpasquier: I have the issue again. What I can say is that for a brief moment it was working, I wrote 2 one-to-one messages and then that was over. There probably is something wrong with the generated notifications.
Something is causing a new user to get POSTed with localhost:8000/users/admin/ (maybe to do with token from a local session?).. I think this can be 'fixed' by adding validation on usernames to make them valid for a URL
I've not opened this in an MR because it's bad practice to validate in the save().. but if we deploy DjangoLDP_account branch username-validation to test-paris then the next time this happens it should kick off and we'll have the log to see when the problem occurs @jbpasquier ?
@jbpasquier sent me the logs from test-pairs and found how the bug is triggered
Internal Server Error: /check-userTraceback (most recent call last):...File "./djangoldp_account/auth/backends.py", line 50, in authenticate user = Solid.get_or_create_user(userinfo, id_token['sub'])...
@calummackervoy The reason is probably that if Paul from HD Toulouse accesses a resource from HD Paris, it will create a local user on Paris' server for Paul's user.
By Alexandre on 2019-12-03T15:50:25 (imported from GitLab project)
@calummackervoy With your recent investigation, you may be more aware of the problem than me, could you handle a call with @sylvain to explain the situation?
Feel free to ask me if more details is needed to explain the track I hinted.
@christophehenry please read my comment above (https://git.happy-dev.fr/startinblox/applications/sib-app/issues/287#note_56199) for context. Spoke to Sylvain about this and the conclusion is that authenticate shouldn't make the call Solid.get_or_create_user(userinfo, id_token['sub']), it should try to GET the user locally, and if it can't return 403
this will fix this issue, the linking data between servers is a separate concern
I guess you guys should call each other to see how to fix this. In any case, if you are to be in charge of DjangoLDP, I guess it's a good idea you get a good understanding of what the problem is.
I have a global understanding of it, but not into the details. But if that can help, don't hesitate to include me in the call.