Open Closed

When-insert-data-CreatorId-has-been-null #8315


User avatar
0
portx-dev created

Continue question https://abp.io/support/questions/8241/When-insert-data-CreatorId-has-been-null

Is there any case where the user information is still available on the client but not on the server? In my environment, there is a CreatorName field that receives the value sent from the client. Even though CreatorName is not null, CreatorId is null.

  • ABP Framework version: v8.3.3
  • UI Type: Angular
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    Because your previous question was closed and has not been resolved, I have returned your ticket.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    CreatorId is obtained from the CurrentUser.

    You can see the logic here https://github.com/abpframework/abp/blob/dev/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditPropertySetter.cs#L65

    In my environment, there is a CreatorName field that receives the value sent from the client. Even though CreatorName is not null, CreatorId is null.

    As far as I know, there is no CreatorName

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    portx-dev created

    @liangshiwei What I mean is CreatorName is a field I created, when calling the api, it is retrieved from the client via

    this.configStateService.getOne("currentUser")
    

    At that time, there was user information on the client but not on the server

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    I guess there is no currentTenant on the server.

    You can try writing log:

    Logger.LogInformation("CurrentTenant Id"+ CurrentTenant.Id);
    Logger.LogInformation("CurrentTenant Name"+ CurrentTenant.Name);
    

    and could you please share the HTTP request body?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    portx-dev created

    This is a post to keep it open.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    portx-dev created

    @liangshiwei TenantId is still inserted into db so I think currentTenant still has value Since my project was initialized from version 5.x and I am seeing in 8.3.2 AuthServerModule.cs there is a code app.UseDynamicClaims(); which I don't have Could it lead to error on my project

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    Could it lead to error on my project

    No. Will not.

    you can try adding a middleware logger to the current claims. for example:

    app.Use(async (httpContext, next) =>
    {
        var logger = httpContext.RequestServices.GetRequiredService<ILogger<QaHttpApiHostModule>>();
        var currentClaims = httpContext.RequestServices.GetRequiredService<ICurrentPrincipalAccessor>();
        foreach (var claim in currentClaims.Principal.Claims)
        {
            logger.LogInformation($"Claim Type: {claim.Type}, Claim Value: {claim.Value}");
        }
       
        await next();
    });
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 09, 2026, 11:56
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.