Learn More, Pay Less!
Limited Time Offer!
Open Closed

Issue Creating Proxies #8665


User avatar
0
maharatha@gmail.com created
  • ABP Framework version: v9.0.2

  • UI Type: Angular

  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

I created 2 Microservice and using the AbpStudio I tried creating proxy for the first microservice and it ran perfectly fine. However when I tried to run the proxy for the second microservice it gives me the below error :;

[Invalid Module] Backend module "myfirstmodulename" does not exist in API definition.

The problem is why its referring to the previous microservice name when I am generating the proxy for the second microservice


18 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello

    Is the myfirstmodulename up and running when you run abp generate-proxy -t ng? Also, can you share your environment.ts file?

    Thank you.

  • User Avatar
    0
    maharatha@gmail.com created

    Yes and No. I tried both but the same error.

    Below is the environment.ts file :

    import { Environment } from '@abp/ng.core';
    
    const baseUrl = 'http://localhost:4200';
    
    const oAuthConfig = {
      issuer: 'http://localhost:44344/',
      redirectUri: baseUrl,
      clientId: 'Angular',
      responseType: 'code',
      scope: 'offline_access openid profile email phone AuthServer IdentityService AdministrationService AuditLoggingService GdprService ChatService SaasService FileManagementService LanguageService FirstService SecondService',
      requireHttps: false,
      impersonation: {
        tenantImpersonation: true,
        userImpersonation: true,
      }
    };
    
    export const environment = {
      production: false,
      application: {
        baseUrl,
        name: 'xxxx',
      }, 
      localization: {
        defaultResourceName: 'xxxx'
      },
      oAuthConfig,
      apis: {
        default: {
          url: 'http://localhost:44308',
          rootNamespace: 'xxxx',
        },
        AbpAccountPublic: {
          url: oAuthConfig.issuer,
          rootNamespace: 'AbpAccountPublic',
        },
      },
    } as Environment;
    
    
  • User Avatar
    0
    maharatha@gmail.com created

    Running abp generate-proxy -t ng gives the same error :

    [Invalid Module] Backend module "firstmodule" does not exist in API definition.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello

    Can you please check this link https://abp.io/support/questions/2824/An-error-occurred-while-generating-the-client-proxy-for-microserviceangular#answer-b3f9c4c1-c15d-b898-1351-3a030eca3ab2 it will helps you.

    Thank you.

  • User Avatar
    0
    maharatha@gmail.com created

    I tried everything but I still get the same error. If I delete the generate-proxy.json and try it then deletes the first service and successfully creates the second service.

    Please provide a solution to this issue else I am unbale to move forward.

    Also the solution you have referred to is 3 years old and I am wondering how come no one else has faced this issue so far.

    I then tried to use this method of creating proxies in different folders and that worked :

    https://abp.io/support/questions/8679/Generate-angular-proxy-for-microservices

    But I don't want this way

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello ,

    Firstly, could you try this approach and check if it works: E.g:-

    abp generate-proxy -t ng -m cetolresultService -u https://localhost:45011 --target cetolresult-service
    

    target: Target for the Angular project to place the generated code.

    Also, verify the version of @abp/ng.schematics by referring to the documentation: https://abp.io/docs/9.0/framework/ui/angular/service-proxies#angular-project-configuration

    Thank you.

  • User Avatar
    0
    maharatha@gmail.com created

    @anjali I have been working on this issue for multiple days and I tried everything trick in the book but unable to solve this issue. Please escalate this issue so that it can be resolved. I need a well thought out solution not jumping from one link to another

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    How do you generate proxy files? If you use Studio, this may be a bug, you can share the steps to reproduce and we will check and fix it.

  • User Avatar
    0
    maharatha@gmail.com created

    I use the Abp Studio to add a new Microservice. Once that's complete I go to the Angular root folder and use the command :

    abp generate-proxy -t ng -url http://localhost:44315 -m servicename

    Note: When I do this process for the first microservice I add it works without issues. But when I add the second microservice thats when the problem begins when creating the proxies :

    abp generate-proxy -t ng -url http://localhost:44355 -m servicename2

    Also till this point I haven't used the Abp Suite to create any pages or anything.

    Am I missing something here ?

  • User Avatar
    1
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I can reproduce the problem,
    I will let the team check it.

    Also till this point I haven't used the Abp Suite to create any pages or anything.

    BTW, you can use suite to generate codes, it will generate proxy files.

  • User Avatar
    0
    maharatha@gmail.com created

    The suite doesn't generate the Angular code until you run generate-proxy after using Abp Suite. So the same issue will happen, please provide me a work around until you fix this issue

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    The suite doesn't generate the Angular code until you run generate-proxy after using Abp Suite. So the same issue will happen, please provide me a work around until you fix this issue

    Hi, for the Microservice template, you should manually generate-proxy (or use the ABP Studio's UI) after Suite code generation. We will update our microservice template, regarding Angular UI.

    https://abp.io/docs/latest/tutorials/microservice/part-03#generating-the-ui-proxy

  • User Avatar
    0
    maharatha@gmail.com created

    I am using Angular as my front end so why should I create proxy for C#. Is my understanding not correct here about proxy generation?

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    I am using Angular as my front end so why should I create proxy for C#. Is my understanding not correct here about proxy generation?

    You should only generate proxy for angular. I just shared the documentation to show you where you can do it in Abp Studio UI

  • User Avatar
    0
    maharatha@gmail.com created

    But I believe Abp Studio doesn't allow to create proxy for Angular, is my understanding correct here?

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    But I believe Abp Studio doesn't allow to create proxy for Angular, is my understanding correct here?

    Yes, currently ABP Studio doesn't allow to generate proxies for Angular. However, in case you would need to generate C# or Js proxies, you can use this documentation. We will update the microservice tutorial asap for Angular UI. I've just shared that if you need a guidance. Regards.

  • User Avatar
    0
    castcrewit created

    Thank You. So looking at it I am currently stuck and can't proceed until there is a fix. Please let me know how to proceed in the absence of a fix. If Proxies can't be created then how do we proceed with building UI

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    Thank You. So looking at it I am currently stuck and can't proceed until there is a fix. Please let me know how to proceed in the absence of a fix. If Proxies can't be created then how do we proceed with building UI

    Actually there is no blocking problem. You can use the following flow for now ( I assume that you already have an microservice solution ):

    1-) Create a new microservice from ABP Studio:

    2-) Open the ABP Suite, and generate CRUD pages with your configuration for this microservice:

    I created a Category entity with Name as its only property for demonstration.

    3-) After generating CRUD pages for a service (CatalogService), you can run all of the runnable projects. Once all of them are up, you can send a request to the CatalogService's endpoint (/api/abp/api-definition) and you'll see the Catalog in the JSON response:

    Run all projects:

    CatalogService's endpoint (/api/abp/api-definition)

    Response of the endpoint (catalog section)

    4-) Then if needed run the generate-proxy command (before that you should change the default API from environment.ts file)

    Please note that, normally you don't need to manually run the generate-proxy, because ABP Suite already should be doing it for you in the angular code generation. However, if there is a problem you can follow this step and manually generate-proxies.

    Change the URL from adminstrationService url's to CatalogService's URL, for only proxy generation, then please don't forget to revert it)

        default: {
          // url: 'http://localhost:44316', -> administration service
          url: "http://localhost:44334", // -> catalog service
          rootNamespace: 'Issue8665',
        },
    

    Generate proxies:

    abp generate-proxy -t ng -m catalog
    

Made with ❤️ on ABP v9.2.0-preview. Updated on February 10, 2025, 13:23