[SOLVED] Login - Server Error

I have…

  • [ ] Checked the logs and have uploaded a log file and provided a link because I found something suspicious there. Please do not post the log file in the topic because very often something important is missing.

See log below:
https://www.sennit.com.br/LOG.TXT

I’m submitting a…

  • [X] Regression (a behavior that stopped working in a new release)
  • [X] Bug report
  • [ ] Performance issue
  • [ ] Documentation issue or request

Current behavior

Hi Sebastian!
I’m using version 4.2.0 docker with authentication via Microsoft and my users are having login issues. In the previous version 4.1.3, this error did not occur. Below the images and logs.
I do rollback to the version 4.1.3 and and the error remained.

Expected behavior

login success

Minimal reproduction of the problem

Environment

  • [X] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: 4.2.0

Browser:

  • [X] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [X] Edge

Others:

I think it is not a login error. I see this in the logs. Seems the apps failed to load because of this:

{
  "logLevel": "Error",
  "action": "GrainInvoked",
  "status": "Failed",
  "grain": "Squidex.Domain.Apps.Entities.Apps.AppDomainObjectGrain",
  "grainMethod": "System.Threading.Tasks.Task\u00601[Squidex.Infrastructure.Orleans.J\u00601[Squidex.Domain.Apps.Entities.Apps.IAppEntity]] GetStateAsync()",
  "app": {
    "name": "Squidex",
    "version": "4.2.0.0",
    "sessionId": "2d64cd0d-bdbe-4cc6-bffb-3df38a4dc6bf"
  },
  "web": {
    "requestId": "|aa1bfa30-43d314bf59ef7f96.",
    "requestPath": "/apps",
    "requestMethod": "GET",
    "routeValues": {
      "area": "Api",
      "action": "GetApps",
      "controller": "Apps"
    }
  },
  "timestamp": "2020-04-02T14:27:25Z",
  "exception": {
    "type": "System.ArgumentException",
    "message": "Id already exists. (Parameter \u0027id\u0027)",
    "stackTrace": "   at Squidex.Domain.Apps.Core.Apps.AppPatterns.Add(Guid id, String name, String pattern, String message) in /src/src/Squidex.Domain.Apps.Core.Model/Apps/AppPatterns.cs:line 45\n   at Squidex.Domain.Apps.Entities.Apps.State.AppState.\u003C\u003Ec.\u003CApplyEvent\u003Eb__48_13(AppPatternAdded ev, AppPatterns p) in /src/src/Squidex.Domain.Apps.Entities/Apps/State/AppState.cs:line 106\n   at Squidex.Domain.Apps.Entities.Apps.State.AppState.UpdatePatterns[T](T event, Func\u00603 update) in /src/src/Squidex.Domain.Apps.Entities/Apps/State/AppState.cs:line 186\n   at Squidex.Domain.Apps.Entities.Apps.State.AppState.ApplyEvent(IEvent event) in /src/src/Squidex.Domain.Apps.Entities/Apps/State/AppState.cs:line 106\n   at Squidex.Domain.Apps.Entities.DomainObjectState\u00601.ApplyEvent(IEvent event, EnvelopeHeaders headers) in /src/src/Squidex.Domain.Apps.Entities/DomainObjectState.cs:line 46\n   at Squidex.Domain.Apps.Entities.DomainObjectState\u00601.Apply(Envelope\u00601 event) in /src/src/Squidex.Domain.Apps.Entities/DomainObjectState.cs:line 83\n   at Squidex.Infrastructure.Commands.DomainObject\u00601.OnEvent(Envelope\u00601 event) in /src/src/Squidex.Infrastructure/Commands/DomainObject.cs:line 96\n   at Squidex.Infrastructure.Commands.DomainObject\u00601.ApplyEvent(Envelope\u00601 event, Boolean isLoading) in /src/src/Squidex.Infrastructure/Commands/DomainObject.cs:line 44\n   at Squidex.Infrastructure.Commands.DomainObject\u00601.\u003COnSetup\u003Eb__6_0(Envelope\u00601 x) in /src/src/Squidex.Infrastructure/Commands/DomainObject.cs:line 37\n   at Squidex.Infrastructure.States.Persistence\u00602.ReadEventsAsync() in /src/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs:line 112\n   at Squidex.Infrastructure.States.Persistence\u00602.ReadAsync(Int64 expectedVersion) in /src/src/Squidex.Infrastructure/States/Persistence{TSnapshot,TKey}.cs:line 83\n   at Squidex.Infrastructure.Commands.DomainObject\u00601.ReadAsync() in /src/src/Squidex.Infrastructure/Commands/DomainObject.cs:line 80\n   at Squidex.Infrastructure.Commands.DomainObjectBase\u00601.EnsureLoadedAsync(Boolean silent) in /src/src/Squidex.Infrastructure/Commands/DomainObjectBase.cs:line 75\n   at Squidex.Domain.Apps.Entities.Apps.AppDomainObjectGrain.GetStateAsync() in /src/src/Squidex.Domain.Apps.Entities/Apps/AppDomainObjectGrain.cs:line 27\n   at Squidex.Domain.Apps.Entities.Apps.OrleansCodeGenAppGrainMethodInvoker.Invoke(IAddressable grain, InvokeMethodRequest request) in /src/src/Squidex.Domain.Apps.Entities/obj/Release/netcoreapp3.1/Squidex.Domain.Apps.Entities.orleans.g.cs:line 33\n   at Orleans.Runtime.GrainMethodInvoker.Invoke()\n   at Squidex.Infrastructure.Orleans.StateFilter.Invoke(IIncomingGrainCallContext context) in /src/src/Squidex.Infrastructure/Orleans/StateFilter.cs:line 51\n   at Orleans.Runtime.GrainMethodInvoker.Invoke()\n   at Squidex.Infrastructure.Orleans.LoggingFilter.Invoke(IIncomingGrainCallContext context) in /src/src/Squidex.Infrastructure/Orleans/LoggingFilter.cs:line 46"
  }
}

You could have a look to the database, I am not sure how this has happened. You can also give me a full backup of your database.

Hi Sebastian!

This is my dump from mongoDB : https://www.sennit.com.br/dump.zip exported by mongodump .

It is important to say that some users are able to log in successfully and others the error remains.

Thanks for your help.

I have no solution yet, but what I also see is:

“CorsPolicyService did not allow origin: https://www.sennit.com.br

1 Like

Thank you, Sebastian.
I will see that this!

Is this related to your issue?

No. My issue refer only to squidex. Not for my site.

A few more questions:

  1. Do you have a Mongo cluster? What is the status?
  2. Do you have a Squidex cluster?
  3. Have you checked the browser logs of the users with login issues?
  4. How do you make CORS requests from your site to squidex?

Answers below:

  1. Yes. Status: http://www.sennit.com.br/mongo.txt

  2. No, I only have one instance of the container.

  3. Images below:


    4.I have no problem with CORS between the site and the squidex. Images and source below:

        get(action: string, parameters?: any, type?: string, token?: string) {
         this.httpHeaders = new HttpHeaders();
    
         this.httpHeaders = this.httpHeaders.append(
           'Access-Control-Allow-Origin',
           '*'
         );
    
         if (type === 'form') {
           this.httpHeaders = this.httpHeaders.append(
             'Content-Type',
             'application/x-www-form-urlencoded'
           );
         } else {
           this.httpHeaders = this.httpHeaders.append(
             'Content-Type',
             'application/json'
           );
         }
    
         this.httpOptions = {
           headers: this.httpHeaders,
           observe: 'response' as any
         };
    
         return this.httpClient
           .get(action, {
             headers: this.httpHeaders,
             params: parameters
           })
           .pipe(tap(data => catchError(this.errorHandler)));
       }
    
     post(action: string, parameters?: any, type?: string, token?: string) {
         this.httpHeaders = new HttpHeaders();
         if (type === 'form') {
           this.httpHeaders = this.httpHeaders.append(
             'Content-Type',
             'application/x-www-form-urlencoded'
           );
         } else {
           this.httpHeaders = this.httpHeaders.append(
             'Content-Type',
             'application/json'
           );
         }
    
         this.httpOptions = {
           headers: this.httpHeaders,
           observe: 'response' as any
         };
    
         return this.httpClient
           .post<any[]>(action, parameters, this.httpOptions)
           .pipe(tap(data => catchError(this.errorHandler)));
       }
    

PS.: The authentication is injected by HttpInterceptor.

I think it is the error I have mentioned above. Do all your users have access to all apps? Perhaps you can try to identity the app that causes the issues.

I tried to reproduce it locally but I do not have the issue.

I did not understand the relationship between my site and squidex in this case. And why only a few users are getting this error (login on squidex). There are 3 users with problems, where 1 has owner access and 2 to different applications.

Would it be possible for me to remove the user to include it again?

I think it is not a login error. The first thing that happens when you open the UI is that the apps get loaded. But as you can see in your screenshot with the chrome error logs, this fails. My assumption is that one app is kind of broken, but I don’t know which it is because I cannot reproduce it with your backup. I also think that it works for the users who do not have access to this app.

Re-adding the users does not help. You can try to restart squidex, this could work. Or you try to figure out which app it is. You can make a user and then add one app at a time and reload the UI.

thank you I will try this.

Hi Sebastian !

I did two tests :

1- I gave to 1 user owner access in all applications and includes in the permissions of the user : squidex.admin.* .The result was the same error.

2- I removed another user from all applications and presented the same message. I hoped he could log in but without any application (would this be the correct behavior?).

PS.: My user has access to all applications, and I’m able to log in normally.

squidex.admin.* gives you technically access to all apps but it does not load them in the UI…only when you have explicit permissions.

it is described here: https://docs.squidex.io/02-documentation/concepts/permissions#administration

Yes, and to give app access, I do adding user in “/settings/contributors” for each app with role “Editor”, in this case.

I have no idea yet…we can make a skype session if you want…

That’s will be greate.
I can include a user who is with this problem so we share the screen with you.
What is the best time (UTC) for you?

What is about 1pm tomorrow?

This greate.
Which email to send the invitation meeting?