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

See original GitHub issue

Hi,

I keep getting this error when I call this.render using koa-jade:


server error [RangeError: Maximum call stack size exceeded] { request: { method: ‘GET’, url: ‘/daniel’, header: { ‘x-real-ip’: ‘10.211.55.2’, ‘x-forwarded-for’: ‘10.211.55.2’, host: ‘docs.sandbox.local:80’, ‘x-nginx-proxy’: ‘true’, connection: ‘close’, ‘cache-control’: ‘max-age=0’, accept: ‘text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8’, ‘upgrade-insecure-requests’: ‘1’, ‘user-agent’: ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36’, ‘accept-encoding’: ‘gzip, deflate, sdch’, ‘accept-language’: ‘en-US,en;q=0.8’, cookie: ‘_ga=GA1.2.1728672733.1439768627’ } }, response: { status: 200, message: ‘OK’, header: { ‘access-control-allow-origin’: ‘*’, ‘access-control-allow-methods’: ‘GET,HEAD,PUT,POST,DELETE’, ‘cache-control’: ‘no-cache’, ‘content-type’: ‘text/html; charset=utf-8’, ‘content-length’: ‘19’ } }, app: { subdomainOffset: 2, env: ‘development’ }, originalUrl: ‘/daniel’, req: ‘<original node req>’, res: ‘<original node res>’, socket: ‘<original node socket>’ }


This is the code:

‘use strict’; ‘use esnext’;

function *base(route, next) { yield this.render(‘base’, { title: ‘Docs’, styles: [ // materialize ‘/materialize.min.css’,

        // material icons
        '/css/materialdesignicons.min.css',

        // graphkit
        '/app.css'
    ],
    vendors: [
        // jquery
        '/jquery.min.js',

        // angular
        '/angular.min.js',
        '/angular-aria.min.js',
        '/angular-route.min.js',

        // materialize
        '/materialize.min.js',

        // d3
        '/d3.min.js'
    ],
    packages: [
        // app
        '/app.js',
        '/auth.js',
        '/connect.js',
        '/http.js',
        '/router.js'
    ]
}, true);

if (undefined !== next) {
    yield next;
}

}

function *index(route, next) { yield this.render(‘routes/index’, {}, true); }

function *profile(route, next) { yield this.render(‘routes/profile’, {}, true); }

function *error(route, next) { yield this.render(‘routes/error404’, {}, true); }

module.exports = function(app) { const koaRoute = require(‘koa-route’); const koaJade = require(‘koa-jade’); const jade = new koaJade({ viewPath: __dirname + ‘/src/views’, debug: ‘development’ == app.env, pretty: ‘development’ == app.env, compileDebug: ‘development’ == app.env, locals: { title: ‘Docs’ }, basedir: ‘/’, noCache: true, helperPath: [ //‘path/to/jade/helpers’, //{ random: ‘path/to/lib.js’ }, ] });

app.use(jade.middleware);

// base
app.use(koaRoute.get('/', base));
app.use(koaRoute.get('/a/welcome', base));
app.use(koaRoute.get('/:username', base));

// index
app.use(koaRoute.get('/route/index', index));

// profile
app.use(koaRoute.get('/route/profile', profile));

};

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisyipcommented, Dec 24, 2016

@ladytellur koa-pug supports koa@1 and koa@2, just use this.render() without yield:

const app = new Koa
const pug = new Pug({ /* options */ })
pug.use(app)

app.use(function* () {
  this.render('index')
})
0reactions
ladytellurcommented, Dec 24, 2016

@chrisyip some of us just wants to use koa@1 until async/await will become native in stable Node version

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 >
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...
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 >
Maximum Call Stack Size Exceeded (Typescript Error) - Medium
Scenario for Maximum Call Stack Size Exceeded Error ... In your code, the possibility is, You are calling a function that is calling...
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