Open Closed

Issues with Adding New Custom Module to New Project 5XX Issue #2444


User avatar
1
bqabani created

We faced three issues when we added a new custom module to the new project:

  • ABP Framework version: v5.1.1

  • UI type: Angular

  • DB provider: EF Core

  • Tiered (MVC) or Identity Server Separated (Angular): no

  • Exception message and stack trace: Autofac.Core.DependencyResolutionException: 'An exception was thrown while activating Volo.Abp.IdentityServer.Grants.PersistedGrantStore -> Volo.Abp.ObjectMapping.DefaultObjectMapper1[[Volo.Abp.IdentityServer.AbpIdentityServerDomainModule, Volo.Abp.IdentityServer.Domain, Version=5.1.1.0, Culture=neutral, PublicKeyToken=null]] -> Volo.Abp.AutoMapper.AutoMapperAutoObjectMappingProvider1[[Volo.Abp.IdentityServer.AbpIdentityServerDomainModule, Volo.Abp.IdentityServer.Domain, Version=5.1.1.0, Culture=neutral, PublicKeyToken=null]] -> λ:Volo.Abp.AutoMapper.IMapperAccessor -> λ:Volo.Abp.AutoMapper.MapperAccessor.'

  • Steps to reproduce the issue:" And added a new module (abp add-module CustomModule --new --add-to-solution-file) Then when I added a simple AppService and related Controller, When I run the project I get this error:


Another issue related to adding custom module: The host app does not generate the migration for the Custom module:

When I add/change entities to a custom abp module. And then run migrator on the host project (EntityFrameworkCore) it did not generate migration script for changes (but it was working on previous versions, and it works on this version when I do changes to the host project, my issue is when I use the custom abp module)

the generated migration is empty


The third issue, a problem with generating proxies:

When I try to run generate proxy command on new project that has one custom module, I face this error:

abp generate-proxy -t ng

[16:49:56 INF] ABP CLI (https://abp.io) [16:49:57 INF] Version 5.1.1 (Stable) [16:49:58 WRN] Couldn't determinate version of "@abp/ng.schematics" package. An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID See ".....\AppData\Local\Temp\ng-C1btyE\angular-errors.log" for further details.

angular-errors.log content is:

[error] Error: NOT SUPPORTED: keyword "id", use "$id" for schema ID at Object.code (....\angular\node_modules@angular-devkit\core\node_modules\ajv\dist\vocabularies\core\id.js:6:15) at keywordCode (....\angular\node_modules@angular-devkit\core\node_modules\ajv\dist\compile\validate\index.js:454:13) at ....\angular\node_modules@angular-devkit\core\node_modules\ajv\dist\compile\validate\index.js:222:17 at CodeGen.code (....\angular\node_modules@angular-devkit\core\node_modules\ajv\dist\compile\codegen\index.js:439:13) at CodeGen.block (....\angular\node_modules@angular-devkit\core\node_modules\ajv\dist\compile\codegen\index.js:568:18) at iterateKeywords (....\angular\node_modules@angular-devkit\core\node_modules\ajv\dist\compile\validate\index.js:219:9) at groupKeywords (....\angular\node_modules@angular-devkit\core\node_modules\ajv\dist\compile\validate\index.js:208:13) at ....\angular\node_modules@angular-devkit\core\node_modules\ajv\dist\compile\validate\index.js:192:13 at CodeGen.code (....\angular\node_modules@angular-devkit\core\node_modules\ajv\dist\compile\codegen\index.js:439:13) at CodeGen.block (....\angular\node_modules@angular-devkit\core\node_modules\ajv\dist\compile\codegen\index.js:568:18)


9 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    And added a new module (abp add-module CustomModule --new --add-to-solution-file) Then when I added a simple AppService and related Controller, When I run the project I get this error:

    Can you share the project with me? liming.ma@volosoft.com

    [error] Error: NOT SUPPORTED: keyword "id", use "$id" for schema ID

    Fixed in 5.1.2

    https://github.com/abpframework/abp/pull/11306

  • User Avatar
    0
    bqabani created

    I send you an email from my personal email (rotahbashi)


    Another issue in v5.1.1 Is when you call unauthorized api you get redirection to login page instead of (authorized response that was available in 4.X.X )

    Looks like you change the authentication challenge, can we get the previous error instead of return to login page?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    I send you an email from my personal email (rotahbashi)

    You can create a new template project.

    Looks like you change the authentication challenge, can we get the previous error instead of return to login page?

    https://github.com/abpframework/abp/issues/9926 https://github.com/abpframework/abp/pull/9940 https://github.com/dotnet/aspnetcore/blob/9da42b9fab4c61fe46627ac0c6877905ec845d5a/src/Security/Authentication/Cookies/src/CookieAuthenticationEvents.cs#L46

  • User Avatar
    0
    bqabani created

    A sample code was sent to you,

    Please lets focus on:

    Another issue related to adding custom module: The host app does not generate the migration for the Custom module:

    When I add/change entities to a custom abp module. And then run migrator on the host project (EntityFrameworkCore) it did not generate migration script for changes (but it was working on previous versions, and it works on this version when I do changes to the host project, my issue is when I use the custom abp module)

    the generated migration is empty

    Try add new migration, it will not add the migration for the Entity in the Custom Module

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    https://github.com/maliming/TestHost https://github.com/maliming/TestHost/commit/10b5a1fdc9f8da5cee38b2915d79254234eede1a

  • User Avatar
    0
    bqabani created

    Dear,

    Thank you for your response, but would you please tell me the needed steps to address this issue in other project, and would you please refer the related article for this issue in abp documentation?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    If you check this commit you will be finger out it is easy.

    https://github.com/maliming/TestHost/commit/10b5a1fdc9f8da5cee38b2915d79254234eede1a

    You can also check the --separate-tenant-schema project.

    abp new QA -t app-pro -u angular --separate-tenant-schema

  • User Avatar
    0
    bqabani created

    Dear,

    I downloaded the code you shared with me, Then added a property to the GeneralSetting.cs Then Added migration: add-migration Test1 -context TestHostDbContext on (TestHost.EntityFrameworkCore) but did not add any migration!

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09