Skip to content
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

app.render callbacks twice #2668

Closed
AtsushiSuzuki opened this issue Jun 3, 2015 · 4 comments
Closed

app.render callbacks twice #2668

AtsushiSuzuki opened this issue Jun 3, 2015 · 4 comments
Assignees

Comments

@AtsushiSuzuki
Copy link

app.render method with callback sometimes callbacks twice, if callback throws exception.

var app = express();
app.set('view engine', 'ejs');

var called = 0;
app.render(__dirname + '/template.ejs', function (err, body) {
  console.log('called: ', ++called);
  throw new Error('some error');
});

Express.js: 4.12.4
ejs: 2.3.1
Node.js: 0.12.2

@dougwilson dougwilson self-assigned this Jun 3, 2015
@dougwilson
Copy link
Contributor

Thanks for the report! This is a bug in the ejs library because their __express export is not async as we require. You can report the bug to ejs at https://github.com/mde/ejs

@dougwilson
Copy link
Contributor

What I can do is put down for Express 5.0 that we will make res.render always be async, even if the view engine you are using is violating our interface and executing the callback sync.

@dougwilson dougwilson mentioned this issue Jun 3, 2015
39 tasks
@AtsushiSuzuki
Copy link
Author

Thank you for reply.
I'm looking forward for 5.0.

@dougwilson
Copy link
Contributor

Ok, this has been integrated in the 5.0 branch and published as part of the 5.0.0-alpha.2 release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants