Open Closed

I have copied the (File Management Abp) into my project as a module everything works fine but when adding the upload service I got an error #7321


User avatar
0
info@tecsolutiongroup.com created
  • ABP Framework version: 6.0.0
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace: NullInjectorError: NullInjectorError: No provider for InjectionToken FILE_MANAGEMENT_XSRF_HEADER_NAME!
  • Steps to reproduce the issue: Which I did provide it to my module as :
export class FileManagementModule {
  static forChild(
    options: FileManagementConfigOptions = {}
  ): ModuleWithProviders<FileManagementModule> {
    return {
      ngModule: FileManagementModule,
      providers: [
        {
          provide: FILE_MANAGEMENT_ENTITY_ACTION_CONTRIBUTORS,
          useValue: options.entityActionContributors,
        },
        {
          provide: FILE_MANAGEMENT_TOOLBAR_ACTION_CONTRIBUTORS,
          useValue: options.toolbarActionContributors,
        },
        {
          provide: FILE_MANAGEMENT_ENTITY_PROP_CONTRIBUTORS,
          useValue: options.entityPropContributors,
        },
        {
          provide: FILE_MANAGEMENT_XSRF_HEADER_NAME,
          useValue: options.xsrfHeaderName || 'RequestVerificationToken',
        },        
        FileManagementInitializer,
      ],
    };
 
  }
  static forLazy(
    options: FileManagementConfigOptions = {}
  ): NgModuleFactory<FileManagementModule> {
    return new LazyModuleFactory(FileManagementModule.forChild(options));
  }
}
“
 
// Upload service

  constructor(
    private localization: LocalizationService,
    private fileService: FileDescriptorService,
    private confirmation: ConfirmationService,
    private updateStream: UpdateStreamService,
    private apiInterceptor: ApiInterceptor,
    private environmentService: EnvironmentService,
    private httpXsrfToken: HttpXsrfTokenExtractor,
    // private headerName: FILE_MANAGEMENT_XSRF_HEADER_NAME,
    @Inject(FILE_MANAGEMENT_XSRF_HEADER_NAME) private headerName: string
  ) {}
 
 
initUppy({ trigger }) {
    const headers = this.apiInterceptor.getAdditionalHeaders();
    headers[this.headerName] = this.httpXsrfToken.getToken();
}
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

5 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Can you share which error you got?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    info@tecsolutiongroup.com created

    The error that appears to us

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    masum.ulu created
    Angular Expert

    Hi, have you add the module to your app-routing.module ? Can you share this file ?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    info@tecsolutiongroup.com created
      {
        path: "drive",
        loadChildren: () => import("./file-management/file-management.module").then(m => m.FileManagementModule),
        canActivate: [AuthGuard, PermissionGuard],
      },
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    masum.ulu created
    Angular Expert

    Hi again, can you add FileManagementModule .forLazy() method ?

    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 28, 2026, 11:44
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.