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.

RangeError: Maximum call stack size exceeded

See original GitHub issue

Package + Version

  • @sentry/browser
  • @sentry/node
  • raven-js
  • raven-node (raven for node)
  • other:

Version:

4.0.6

Description

I got the following errors multiple times:

FIRST

RangeError: Maximum call stack size exceeded at String.includes (<anonymous>) at clientRequest.emit (…/node_modules/@sentry/node/dist/integrations/http.js:94:97)

Issues on sentry: https://sentry.io/dymafr/express-app/issues/704935865/?query=is:unresolved

SECOND RangeError: Maximum call stack size exceeded at String.includes (<anonymous>) at clientRequest.emit (…node_modules/@sentry/node/dist/integrations/http.js:81:21)

Call: /**

  • Wrapper function for request’s emit calls */ function emitWrapper(origEmit) { return function (event, response) { // I’m not sure why but Node.js (at least in v8.X) // is emitting all events twice 😐 if (lastResponse === undefined || lastResponse !== response) { lastResponse = response; } else { return origEmit.apply(this, arguments);

Issues on sentry: https://sentry.io/dymafr/express-app/issues/704810638/?query=is:unresolved

I have no clue where they come from.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kamilogorekcommented, Oct 6, 2018

Perfect, thanks @darkobits. I’ll investigate it.

0reactions
darkobitscommented, Oct 6, 2018

I’m experiencing this same issue. Instead of socket.io, I’m using the aws-sdk.

Here’s a minimal test case:

@sentry/node  4.0.6
node          8.9.4
npm           6.4.1   
const {SQS} = require('aws-sdk');
const Sentry = require('@sentry/node');


// Track number of requests completed.
let requestCount = 0;


// Create an SQS client that will talk to Localstack.
const sqs = new SQS({
  endpoint: 'http://localhost:4576',
  accessKeyId: 'rainbows',
  secretAccessKey: 'unicorns',
  region: 'us-west-1'
});


/**
 * Continuously "polls" SQS to do <important things here>. In this case, we just
 * call the getQueueAttributes method.
 *
 * The request pool (making 10 requests at a time instead of 1) just helps the
 * test run faster.
 */
async function poll(QueueUrl) {
  const requestPool = [];

  for (let i = 0; i < 10; i++) {
    const requestPromise = sqs.getQueueAttributes({
      QueueUrl,
      AttributeNames: ['All']
    })
    .promise()
    .then(() => {
      requestCount++;
      console.log(`${requestCount} requests processed.`);
    });

    requestPool.push(requestPromise);
  }

  await Promise.all(requestPool);
}


async function main() {
  try {
    // We have to pass an empty object here or we will get a 'cannot read
    // property X of undefined' error. A null check on 'options' should probably
    // be added to Sentry to prevent this.
    Sentry.init({});

    // Create a new queue / get existing queue.
    const {QueueUrl} = await sqs.createQueue({QueueName: 'foo'}).promise();

    while (true) {
      await poll(QueueUrl);
    }
  } catch (err) {
    console.error('Error:', err.stack);
    process.exit(1);
  }
}


main();

Repo with this test: https://github.com/darkobits/sentry-range-error


With Sentry.init being called, you can get up to 4,500 requests before a RangeError is thrown. This is about the same number I am getting in my other project as well.

With Sentry.init removed, the test runs indefinitely.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
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 >
RangeError: Maximum call stack size exceeded - Educative.io
The most common source for this error is infinite recursion. You must have a recursive function in your code whose base case is...
Read more >
Uncaught RangeError: Maximum call ... - Net-Informations.Com
This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript...
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 >

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