I am reopening this issue again via a different ticket as it was closed .
The example you provided I saaw is you tried with only 1 new micro service. If you read my issue carefully , the issue comes in when you go and generate the proxies for the second microservice.
So try to generate the proxies for the second microservice and check.
By the way , I tried your solution and the same issue exists.
8 Answer(s)
-
0
Hi, I have assigned an angular team member to answer your question. She will better assist you in your problem (since https://abp.io/support/questions/8665/Issue-Creating-Proxies#answer-3a17aa1c-73ab-db44-8941-f6c140b82fc4 this did not fix your problem).
Regards.
-
0
Hello, I understand that the problem persists when generating proxies for the second microservice.
To address this, please ensure you are passing the
--target
argument correctly for the specific project or library. The following command should work:abp generate-proxy -t ng -url <apiUrl> -m <serviceName> --target <projectName>
Could you try this and let us know if the issue still occurs? If it does, please share any error messages or additional details so we can investigate further.
-
0
I will try but did you try to replicate and follow your own instructions. I have been dealing with this issue for quite sometime and have tried multiple things. I am expecting few trials from your side as well.
-
0
I have replicated the error on my end as well. It appears that the issue is related to separate services expecting targets to be placed correctly for the proxies to function as intended.
Based on your responses, I wasn’t sure if you had tried this approach. Could you confirm?
-
0
Here are my observations :
When I use the target and the project name which is essentially the sub folder name in the angular folder it does creates the proxies but it creates here : projects/project folder(e.g.XYZ)/src/lib/proxy/generate-proxy.json
XYZ is the microservice folder
But the first microservice proxies which I created without the project name gets created here :
projects/ABC/project folder(e.g.ABC)/app/proxy/generate-proxy.jsonABC is the solution name.
I want to understand where exactly the proxies has to be created when there are multiple microservices so that the whole thing will work fine.
There needs to be very clear cut documentation around generating proxies for Angular project so that no one has to go through what I am going through.
-
0
I understand your concern, and I appreciate your detailed observations. To clarify how proxy generation should work in a multi-microservice Angular project, let me walk you through an example setup:
-
I created a project named as MicroserviceTest
-
Then I added these services as my colleague has explained here.
-
Then I created the libraries for the angular project using the angular cli since each library acts as an independent module representing a specific microservice.
-
yarn ng generate library my-service-1
-
yarn ng generate library my-service-2
The folder structure will look like this
-
-
Then you can run these commands to generate the proxies for the services you created:
-
abp generate-proxy -t ng -u <ServiceUrl> -m myservice1 --target my-service-1
-
abp generate-proxy -t ng -u <ServiceUrl> -m myservice1 --target my-service-2
-
Thanks for bringing up the documentation update. Even if updating such comprehensive documentation takes time, we will make sure this point is clearly explained to improve the developer experience. Let me know if you need further clarification!
-
-
0
Are you sure you were able to run the last set of commands :
abp generate-proxy -t ng -u <ServiceUrl> -m myservice1 --target my-service-1
abp generate-proxy -t ng -u <ServiceUrl> -m myservice1 --target my-service-2
Can you put the screenshot here which shows the proxies are being generated, I tried and it gives me error.
I tried with the first one and it gives the below error :
[Invalid Module] Backend module "CoreService" does not exist in API definition.
When I did run the second service this is what I am getting :
[Project Not Found] Either define a default project in your workspace or specify the project name in schematics options.
The set of commands are identical barring the parameter values.
I need some workable solution every time I am raising an issue I get a response that you are able to replicate the issue and then I get a half baked and tested solution from your end.
Please send me a workable solution and do send me your code to verify that
-
0
Thanks for reaching out! I understand the frustration, and let's resolve this step by step.
First error:
[Invalid Module] Backend module "CoreService" does not exist in API definition.
-
This suggests that
CoreService
is not defined in the API. -
Check
CoreServiceRemoteServiceConsts.cs
for the correct module name and update your command accordingly.
Second error:
[Project Not Found] Either define a default project in your workspace or specify the project name in schematics options.
-
This happens when the Angular CLI can't find the project.
-
Verify the project name in
angular.json
"projects": { "ticket8665": { "projectType": "application", ... "root": "projects/ticket8665", "sourceRoot": "projects/ticket8665/src", "prefix": "app", ... }, "my-service-1": { "projectType": "library", "root": "projects/my-service-1", "sourceRoot": "projects/my-service-1/src", "prefix": "lib", ... }, "my-service-2": { "projectType": "library", "root": "projects/my-service-2", "sourceRoot": "projects/my-service-2/src", "prefix": "lib", ... } }
For reference, here’s a sample project. If issues persist, please share your API definition and error screenshot so we can assist further.
-