Open Closed

Generate-proxy service/endpoint max count #3471


User avatar
0
Kaspars.Avotins created
  • ABP Framework version: v5.2.1

  • UI type: Angular

  • DB provider: EF Core

  • Node version: 14.20.0

  • Problem with abp generate-proxy -t ng: RangeError: Maximum call stack size exceeded at Observable._trySubscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:51:34) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:30:22) at MergeMapOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\mergeMap.js:37:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31) at DefaultIfEmptyOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\defaultIfEmpty.js:27:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31) at TakeLastOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\takeLast.js:38:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31) at ThrowIfEmptyOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\throwIfEmpty.js:30:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31)

  • First this is not fixed but closed. Why?: https://support.abp.io/QA/Questions/3185/Generate-proxy-issue-Angular We found that with abp v5.2.1 and node version 14.20.0 it works. (At least for Windows) That is reason for using older abp and node versions.

  • This range exception occurs at large endpoint count. If added any new endpoint this error will be thrown. If you delete any of old endpoints it works again for new service/endpoint.


15 Answer(s)
  • User Avatar
    0
    muhammedaltug created

    Hello,

    Sorry for the late response.

    We fixed the error related to url parameter in version 5.3.0-rc.2

    Could you send the response of api/abp/api-definition endpoint so we can understand the issue you are facing?

  • User Avatar
    0
    Kaspars.Avotins created

    Ok, so again.

    As stated in previous ticket there is still url error. Here are some tests.


    abp: v5.3.0-rc.2; v5.3.0-rc.3; v5.3.1; v5.3.3; node: v14.20.0; v16.15.0; v18.6.0;

    Unknown option: '--url' Unknown option: 'https://localhost:44329/' Microsoft Windows [Version 10.0.19042.1826] (c) Microsoft Corporation. All rights reserved.


    abp: v5.2.0-rc.2; v5.2.1; node: v16.15.0; v17.3.0; v18.6.0 RangeError: Maximum call stack size exceeded at formatWithOptionsInternal (node:internal/util/inspect:2167:40) at format (node:internal/util/inspect:2021:10) at console.warn (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular\cli\lib\cli\index.js:45:39) at Observable._trySubscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:55:25) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:30:22) at MergeMapOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\mergeMap.js:37:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31) at DefaultIfEmptyOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\defaultIfEmpty.js:27:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31) at TakeLastOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\takeLast.js:38:23)


    And now as stated before only version we found working is this. But now we get error when there is too many endpoints. As you asked for definition file it loads and there is no error (Takes some time thought). Here is url to response. api/abp/api-definition response abp: v5.2.1; node: v14.20.0;

    --maximums call stack. RangeError: Maximum call stack size exceeded at Observable._trySubscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:51:34) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:30:22) at MergeMapOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\mergeMap.js:37:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31) at DefaultIfEmptyOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\defaultIfEmpty.js:27:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31) at TakeLastOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\takeLast.js:38:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31) at ThrowIfEmptyOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\throwIfEmpty.js:30:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31)

  • User Avatar
    0
    muhammedaltug created

    Hello,

    Did you update the "@abp/ng.schematics" package version also?

    I was able to reproduce the range error. You can follow the status of issue

  • User Avatar
    0
    Kaspars.Avotins created

    Hello,

    Did you update the "@abp/ng.schematics" package version also?

    I was able to reproduce the range error. You can follow the status of issue


    Updated schematics and tested again, same url error for later abp version: @abp/ng.schematics: v5.3.3 abp: v5.3.3 node: v14.20.0; v16.15.0; v18.6.0;

    Unknown option: '--url' Unknown option: 'https://localhost:44329/' Microsoft Windows [Version 10.0.19042.1826] (c) Microsoft Corporation. All rights reserved.

  • User Avatar
    0
    muhammedaltug created

    Hello,

    I created a new app with ABP version 5.3.3. I tried proxy generation with url param. Proxy generation works fine as expected.

    I took a screen recording. You can access the related video from this link

    Can you share the result of 'yarn why @abp/ng.schematics' command in your angular directory?

  • User Avatar
    0
    Kaspars.Avotins created

    Hello,

    I created a new app with ABP version 5.3.3. I tried proxy generation with url param. Proxy generation works fine as expected.

    I took a screen recording. You can access the related video from this link

    Can you share the result of 'yarn why @abp/ng.schematics' command in your angular directory?

    Thank you, there was problem with @abp/ng.schematics version.

    Now it works for: abp: v5.3.3 node: v14.20.0 Still problem with endpoints max count. Can you give us any time estimates for 5.3-patch-final? Like weeks or months?

    Not working for different node version: abp: v5.3.3 node: v16.15.0; v18.6.0; Just in case if you didn't notice previously this is not same error as with endpoint max count.

    RangeError: Maximum call stack size exceeded at formatWithOptionsInternal (node:internal/util/inspect:2246:40) at format (node:internal/util/inspect:2100:10) at console.warn (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular\cli\lib\cli\index.js:45:39) at Observable._trySubscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:55:25) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:30:22) at MergeMapOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\mergeMap.js:37:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31) at DefaultIfEmptyOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\defaultIfEmpty.js:27:23) at Observable.subscribe (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\Observable.js:25:31) at TakeLastOperator.call (D:\Projects\iRMS\iRMS.Frontend\node_modules\@angular-devkit\schematics\node_modules\rxjs\internal\operators\takeLast.js:38:23)

  • User Avatar
    0
    muhammedaltug created

    Hello,

    Can you send me response of api/abp/api-definition?includeTypes=true endpoint. Sorry for the request again. I forgot to ask with the includeTypes parameter in the first asking.

    I think I found the solution. I will try to fix it in the next version of 5.3.

    But there is a workaround for the error. If you increase the stack size of NodeJs, the command works properly. Add the command below to your package.json;

    //package.json
    {
    "scripts": {
        "generate-proxy": "node --stack-size=1200 ./node_modules/.bin/ng g @abp/ng.schematics/collection.json:proxy-add --module __default --apiName __default --source __default --target __default --url https://YOUR_URL"
    }
    

    And run the command with

    yarn generate-proxy
    

    or

    npm run generate-proxy
    
  • User Avatar
    0
    Kaspars.Avotins created

    Link to response with types: response with types

    Will try workaround tomorrow. Simply adding and running it didnt work got some errors. I presume this is abp version 5.3.3? What node version are you running this with?

  • User Avatar
    0
    muhammedaltug created

    Hello,

    The next version that version of 5.3 will publish is 5.3.4. 5.3.3 version already published.

    I tried in node 14.17.0 and node 16.16.0.

    Can you send the errors you faced?

  • User Avatar
    0
    Kaspars.Avotins created

    I simply get this standard error:

    `> node --stack-size=1200 ./node_modules/.bin/ng g @abp/ng.schematics/collection.json:proxy-add --module __default --apiName __default --source __default --target __default --url https://localhost:44329

    D:\Projects\iRMS\iRMS.Frontend\node_modules.bin\ng:2 basedir=$(dirname "$(echo "$0" | sed -e 's,\,/,g')") ^^^^^^^

    SyntaxError: missing ) after argument list at Object.compileFunction (node:vm:352:18) at wrapSafe (node:internal/modules/cjs/loader:1033:15) at Module._compile (node:internal/modules/cjs/loader:1069:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47`

  • User Avatar
    0
    muhammedaltug created

    Hello

    This error is related to windows. Can you replace the generate-proxy command with the below?

    "scripts": {
        "generate-proxy": "node --stack-size=1200 ./node_modules/@angular/cli/bin/ng.js g @abp/ng.schematics/collection.json:proxy-add --module __default --apiName __default --source __default --target __default --url https://YOUR_URL"
    }
    
  • User Avatar
    0
    Kaspars.Avotins created

    With this nothing happens. No error, just nothing happens.

    If I change url to something incorrect I get error. [API Not Available] Request to https://localhost:4432/api/abp/api-definition is unsuccessful. Please double-check the URL in the source pro ject environment and make sure your application is up and running.

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hello @Kaspars.Avotin

    We've understood the problem. It happens only in win32-x64 systems. https://github.com/sass/node-sass/issues/1863#issuecomment-299136177

    We tried on Ubuntu 20.04 with your json file and everything worked well. So, the problem isn't related with ABP Framework. I have a couple of suggestions for you. You can use different operation system to overcome the problem like Linux or MacOS. But it may not be sustainable. So you can use a Linux distribution like Ubuntu on your Windows machine. The best way to do that is using WSL2.

    Let me explain step by step about how we configured it.

    1. Run your HttpApi.Host project on your windows normally.

    2. Expose your localhost to the world with ngrok You can also use IPv4 address to connect to your running application from WSL but there might be a lot of firewall issues according to your computer. This is the best stable way

      • Download and make setups for ngrok according to its documentation and ensure you configured your authtoken.
      • Let's say your backend project runs on https://localhost:44360, use the following command to expose your application with https scheme
        .\ngrok.exe http https://localhost:44360
        
      • Configure --url as ngrok URL in package.json
    3. Now you're ready to generate your script in WSL.

    4. Make sure you have an Ubuntu with WSL2 on your windows.

      • (https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-10#1-overview)
    5. Open a new terminal (PS), navigate to your angular project path and switch to the Ubuntu. It'll automatically go to your mounted angular folder in ubuntu.

    6. Make sure nodejs and npm are installed on ubuntu instance. Follow this one: https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions

    7. After installation if npm or ubuntu commands aren't available you can run bash command once more.

    8. Generate the proxy in ubuntu terminal.

       npm run generate-proxy
      

      (It takes much more time, I've just clipped the waiting time from the gif)


    Or you can use macOS or Linux development environment. But Windows WSL2 is doing its job well.

  • User Avatar
    1
    Kaspars.Avotins created

    Thanks, workaround works with wsl2.

    Sadly we have .net console application that runs proxy-generation and then fixes/changes some of the files.

    Anyway, thanks workaround works.

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    You can consider running that job on a Linux server or configure a wsl2 terminal for that operation.


    As a best practice, I suggest you separate your project into modules. In this way, you can generate your client-proxies module by module, This way reduces JSON sizes. Then you won't get any 'Maximum call stack size exceeded' exception.

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