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.

[assert] RangeError: Maximum call stack size exceeded

See original GitHub issue

After trying to update some projects to AWS CDK 1.68.0 I’m seeing the following behavior in our unit tests:

    RangeError: Maximum call stack size exceeded

      at deepCopy (node_modules/@aws-cdk/cloudformation-diff/lib/diff-template.ts:168:18)
      at deepCopy (node_modules/@aws-cdk/cloudformation-diff/lib/diff-template.ts:176:18)
          at Array.map (<anonymous>)
      at deepCopy (node_modules/@aws-cdk/cloudformation-diff/lib/diff-template.ts:170:14)
[...]
      at deepCopy (node_modules/@aws-cdk/cloudformation-diff/lib/diff-template.ts:176:18)
          at Array.map (<anonymous>)
      at deepCopy (node_modules/@aws-cdk/cloudformation-diff/lib/diff-template.ts:170:14)

cdk synth for the stack in question seems to produce a proper template. Any ideas what might cause this?

Reproduction Steps

The test cases are pretty much in this form:

import { expect as expectCDK, matchTemplate, MatchStyle } from '@aws-cdk/assert';
import * as cdk from '@aws-cdk/core';
import { ExampleStack } from '../lib/example-stack';

test('ExampleStack', () => {
  const app = new cdk.App();
  // WHEN
  const stack = new ExampleStack(app, `ecs-stack`);

  // THEN
  const expected = {
    'Resources': {
        /// ... resource definitions
    }
  };

  expectCDK(stack).to(matchTemplate(expected, MatchStyle.SUPERSET));
});

Environment

  • CLI Version : 1.68.0
  • Framework Version: 1.68.0
  • Node.js Version: v14.8.0
  • OS : macOs
  • Language (Version): TypeScript 4

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
MAGilleeneycommented, Feb 2, 2021

Sorry for commenting on closed issue, however this is the only solution i found that helped me. Markusl is correct that this was from a version mismatch however in my case i had a version mismatch when I added a new contruct so i used npm-check -u to update all versions. Running my tests gave the exact same error above, even though my versions were in sync.

Deleting package-lock.json & node_modules and reinstalling packages fixed the issue.

1reaction
markuslcommented, Oct 24, 2020

@nija-at I see. I think what is different in our case was including a CDK construct with a different version (<1.68.0) of CDK libraries (and assert library) as part of the main CDK project with a library version 1.68.0. I wasn’t able to figure out why this happened, but now after upgrading the main project to CDK 1.70.0 the problem went away. I’ll get back to this if it happens again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript RangeError: Maximum Call Stack Size Exceeded
The RangeError: Maximum call stack size exceeded is thrown when a function call is made that exceeds the call stack size. This can...
Read more >
node.js - node_modules/mongodb/src/bson.ts:38:3
Testing with mongoose and typescript: RangeError: Maximum call stack size exceeded - node_modules/mongodb/src/bson.ts:38:3.
Read more >
Avoid Maximum call stack size exceeded in JavaScript
Error Maximum call stack size exceeded is raised when calling a recursive function in a loop · This is expected – as every...
Read more >
KJS / IR: "RangeError: Maximum call stack size exceeded ...
KJS / IR: "RangeError: Maximum call stack size exceeded": Default function overloads marked with @JsExport are broken · Problem · Expected Behaviour ·...
Read more >
LWC: Maximum Callstack Size Exceeded
Likely to be this: @api alternativeText; get alternativeText() { return this.alternativeText; }. where this.alternativeText inside the get ...
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