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

Advice on usage of res.render() from express. #652

Open
mortenbekditlevsen opened this issue Nov 5, 2024 · 2 comments
Open

Advice on usage of res.render() from express. #652

mortenbekditlevsen opened this issue Nov 5, 2024 · 2 comments
Assignees

Comments

@mortenbekditlevsen
Copy link

Currently I get the following error in my functions logs occationally:
Error: No default engine was specified and no extension was provided.

Reading about express, it appears that this is caused when calling render without a configured engine.

In logger.ts line 102, there is a call to res.render(...).

res.render('error', {error: err});

Just dealing with Cloud Functions that can return a result or give an error, leaves me in doubt about where I should configure this engine, and to what, and for what purpose.

Could this error be communicated without the use of render? Or alternatively - could you provide guidance about when, where and why the configuration should happen?

@danteoh
Copy link

danteoh commented Nov 6, 2024

+1 to this - I'm literally just trying to run the vanilla cloud function sample code and running into this.

@mortenbekditlevsen
Copy link
Author

Update: This appears to be happening on an internally defined 'express' app, so there's no way for us to configure the 'view engine', mening that this will always fail in a way that's hard for the end user to figure out.

My use case is that we have a customer that sends invalid json to an API. We would like to assist them with a concrete example of what goes wrong, but we can't intercept the request body before the error, and due to the res.render() call, all the user sees is an 'internal server error' even though the data is clearly bad.

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

No branches or pull requests

3 participants