New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maximum call stack size exceeded #14
Comments
@DanielDahan Can you, please explain how did you managed to solve this issue? |
I've solved it by removing router.get('/', function *() {
this.render('index', { a: b });
}); However it might not be the behaviour you want. |
Can we reopen this until there is a fix that doesn't require removing yield statements? They're kind of important |
I looked over my code, and I also removed the yield call. |
Here's the reasons: Normal function is faster than generator function:
Koa team encourages to use normal functions (see
|
@chrisyip some of us just wants to use koa@1 until async/await will become native in stable Node version |
@ladytellur const app = new Koa
const pug = new Pug({ /* options */ })
pug.use(app)
app.use(function* () {
this.render('index')
}) |
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: '',
res: '',
socket: '' }
This is the code:
'use strict';
'use esnext';
function *base(route, next) {
yield this.render('base', {
title: 'Docs',
styles: [
// materialize
'/materialize.min.css',
}
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' },
]
});
};
The text was updated successfully, but these errors were encountered: