Open Closed

Cannot generate proxy microservice/angular #3444


0
[email protected] created
  • ABP Framework version: v5.3.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace: [Invalid Module] Backend module "productService" does not exist in API definition.
  • Steps to reproduce the issue: create new microservice solution, add a new service - CoreService, create a new entity and exec abp generate-proxy -t ng -m coreService -url https://localhost:45051

I have created a microservice solution with Angular UI. It has the sample product service and I have added an additional core service for the application. After some changes to controller for the new entity when I try to regenerate the proxy I recieve the above error. If there is only one service it generates without any issues. But for multiple services it throws the error.


4 Answer(s)
  • 0
    muhammedaltug created
    Support Team

    Hello,

    Currently, proxy generation in angular microservice templates needs extra steps. We will work on this. Please follow steps in gist

  • 0
    [email protected] created

    Hello,

    I have followed these steps but it generates proxies under projects/my-service while the components are generated under src/my-entity. How to ensure that both proxies and components for a service are generated in one location only?

  • 0
    [email protected] created

    Hello,

    I created the my-service ng module as suggested in the gist but after updating to abp suite 5.3.3 I am getting an error when generating the angular UI from abp suite. Kindly see below the structure of the module and the error

    I was able to generate the angular UI once the my-service library was removed from apps/angular/projects and apps/angular/angular.json

    But the my-service library is required to regenerate proxies for the services so please let me know a fix or alternative for the same.

  • 0
    muhammedaltug created
    Support Team

    Hello,

    Sorry for the late response.

    The problem is there are no libs for each microservices in the microservice angular project. We will modify our microservice angular template and configure proxy generation and ABP Suite for this case.

    We have found a temporary solution for using suite and abp proxy generation. Please follow the steps below;

    • Create a new application with the module-pro template with the command below
      abp new YourNameSpace.YourServiceName -t module-pro --csf
      
    • Replace the module lib placed in angular/projects/your-service with your microservice angular project's lib
    • Add config secondary entrypoint's path to your tsconfig.json
      "your-service/config": ["projects/your-service/config/src/public-api.ts"]
      
    • Change your routing configuration to load module in your-service lib
      //app.routing.module.ts
      {
          path: 'your-service',
          loadChildren: () => import('your-service').then(m => m.YourServiceModule.forLazy()),
      }
      
    • Remove the old route definition from route.provider.ts
    • Import the YourServiceConfigModule with forRoot to your app module.
      //app.module.ts
      import { NgModule } from '@angular/core';
      import { YourServiceConfigModule } from 'your-service/config';
      
      @NgModule({
        declarations: [AppComponent],
        imports: [
          //other imports
          YourServiceConfigModule.forRoot(),
        ]
      })
      export class AppModule {}
      
    • If the .suite folder does not exist in the angular folder. Please rerun the CRUD Page Generator.
    • Replace the index.js file placed in angular/.suite/schematics/commands/entity with file in gist
    • Rerun CRUD Page Generator
    • You can use generated components and services by importing with relative path in your lib. If you want to use out of lib you need to export these files in the service's public-api.ts