question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maximum Call Stack Size Exceeded with version 5

See original GitHub issue

Type of Issue

[X] Bug Report
[ ] Feature Request

Description

After upgrading to ng-packagr 5 I see the following output for a project that builds fine with v4:

BUILD ERROR
Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at MetadataBundler.convertValue (C:\d\ContentHub\prod-wch-sdk-ng7\utils\node_modules\@angular\compiler-cli\src\metadata\bundler.js:355:21)
    at MetadataBundler.convertValue (C:\d\ContentHub\prod-wch-sdk-ng7\utils\node_modules\@angular\compiler-cli\src\metadata\bundler.js:372:36)
    at MetadataBundler.convertValue (C:\d\ContentHub\prod-wch-sdk-ng7\utils\node_modules\@angular\compiler-cli\src\metadata\bundler.js:372:36)
    at MetadataBundler.convertValue (C:\d\ContentHub\prod-wch-sdk-ng7\utils\node_modules\@angular\compiler-cli\src\metadata\bundler.js:372:36)
    at MetadataBundler.convertValue (C:\d\ContentHub\prod-wch-sdk-ng7\utils\node_modules\@angular\compiler-cli\src\metadata\bundler.js:372:36)
    at MetadataBundler.convertValue (C:\d\ContentHub\prod-wch-sdk-ng7\utils\node_modules\@angular\compiler-cli\src\metadata\bundler.js:372:36)
    at MetadataBundler.convertValue (C:\d\ContentHub\prod-wch-sdk-ng7\utils\node_modules\@angular\compiler-cli\src\metadata\bundler.js:372:36)
    at MetadataBundler.convertValue (C:\d\ContentHub\prod-wch-sdk-ng7\utils\node_modules\@angular\compiler-cli\src\metadata\bundler.js:372:36)
    at MetadataBundler.convertValue (C:\d\ContentHub\prod-wch-sdk-ng7\utils\node_modules\@angular\compiler-cli\src\metadata\bundler.js:372:36)
    at MetadataBundler.convertValue (C:\d\ContentHub\prod-wch-sdk-ng7\utils\node_modules\@angular\compiler-cli\src\metadata\bundler.js:372:36)

Downgrading to v4 solves this, without and further changes.

My dependencies:

  "dependencies": {
    "@ibm-wch-sdk/api": "7.2.601",
    "loose-envify": "^1.4.0"
  },
  "devDependencies": {
    "@angular/cli": "^7.3.7",
    "@angular/compiler": "^7.2.11",
    "@angular/compiler-cli": "^7.2.11",
    "@angular/core": "^7.2.11",
    "@angular/language-service": "^7.2.11",
    "@types/jest": "^23.3.5",
    "@types/node": "^11.12.0",
    "core-js": "^3.0.0",
    "cpx": "^1.5.0",
    "jest": "^23.6.0",
    "exitzero": "^1.0.1",
    "jsdom": "^13.2.0",
    "lucene": "^2.0.1",
    "ng-packagr": "^5.0.1",
    "npm-run-all": "^4.1.5",
    "requestidlecallback": "^0.3.0",
    "rimraf": "^2.6.3",
    "rxjs": "~6.3.3",
    "rxjs-marbles": "^3.0.1",
    "rxjs-tslint-rules": "^4.11.0",
    "sync-files": "^1.0.3",
    "tools-helper-merge-markdown": "^0.1.112",
    "ts-jest": "^23.10.4",
    "ts-node": "^8.0.3",
    "tsickle": "^0.34.3",
    "tslib": "^1.9.3",
    "tslint": "^5.14.0",
    "tslint-sonarts": "^1.7.0",
    "typedoc": "^0.13.0",
    "typedoc-plugin-markdown": "^1.1.17",
    "typescript": "~3.2.2",
    "url-search-params-polyfill": "^3.0.0",
    "uuid": "^3.3.2",
    "zone.js": "^0.8.29"
  },

This looks similar to #1093 but in my case I am not referencing any barrel files, all imports are referenced via direct file references.

Is there anything in the logging I can do to nail down the problem?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:21 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
SebastianPodgajnycommented, May 13, 2019
Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
    at MetadataBundler.convertValue (/src/node_modules/@angular/compiler-cli/src/metadata/bundler.js:1:1)
    at MetadataBundler.convertValue (/src/node_modules/@angular/compiler-cli/src/metadata/bundler.js:366:36)
    at MetadataBundler.convertValue (/src/node_modules/@angular/compiler-cli/src/metadata/bundler.js:366:36)
    at MetadataBundler.convertValue (/src/node_modules/@angular/compiler-cli/src/metadata/bundler.js:366:36)
    at MetadataBundler.convertValue (/src/node_modules/@angular/compiler-cli/src/metadata/bundler.js:366:36)
    at MetadataBundler.convertValue (/src/node_modules/@angular/compiler-cli/src/metadata/bundler.js:366:36)
    at MetadataBundler.convertValue (/src/node_modules/@angular/compiler-cli/src/metadata/bundler.js:366:36)

code that produces error

export function generateUuid(): string {
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c: string): string {
    const r = (Math.random() * 16) | 0,
      v = c === 'x' ? r : (r & 0x3) | 0x8;
    return v.toString(16);
  });
}

working code

export function generateUuid(): string {
  const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
    /[xy]/g,
    (c: string): string => {
      const r = (Math.random() * 16) | 0,
        v = c === 'x' ? r : (r & 0x3) | 0x8;
      return v.toString(16);
    },
  );

  return uuid;
}

environment mhart/alpine-node:10

Angular CLI: 7.3.5
Node: 10.15.1
OS: darwin x64
Angular: 7.2.8
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.13.5
@angular-devkit/build-angular      0.13.5
@angular-devkit/build-ng-packagr   0.13.5
@angular-devkit/build-optimizer    0.13.5
@angular-devkit/build-webpack      0.13.8
@angular-devkit/core               7.3.5
@angular-devkit/schematics         7.3.5
@angular/cdk                       7.3.7
@angular/cli                       7.3.5
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.3.5
@schematics/angular                7.3.5
@schematics/update                 0.13.5
ng-packagr                         5.1.0
rxjs                               6.4.0
typescript                         3.2.4
webpack                            4.29.0
2reactions
alan-agius4commented, Mar 31, 2019

Hi, I tried this locally, and it seems that the issue is related to the node version, when I used Node 10.10 it failed however when using Node 11 it worked as expected.

Screenshot 2019-03-31 at 12 50 51

I didn’t find the root cause of this issue though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript RangeError: Maximum Call Stack Size Exceeded
The JavaScript RangeError: Maximum call stack size exceeded is an error that occurs when there are too many function calls, or if a...
Read more >
JavaScript Error: Maximum Call Stack Size Exceeded
If you see the “Maximum Call Stack Size Exceeded” error, there's likely a problem with a recursive function within your JavaScript code.
Read more >
javascript - Maximum call stack size exceeded error
It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you...
Read more >
How to fix: "RangeError: Maximum call stack size exceeded"
A "RangeError: Maximum call stack size exceeded" is an error that occurs when a function or operation tries to execute too many nested...
Read more >
Uncaught RangeError: Maximum call ... - Net-Informations.Com
Maximum call stack size exceeded error. This error is almost always means you have a problem with recursion in JavaScript code, as there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found