I have a small express app running in a lambda function. It sets the view directory like so:
const viewsDir = path.join(__dirname, '..', 'render'); app.set('views', viewsDir); app.set('view engine', 'ejs'); app.engine('ejs', ejs.__express); // without this Netlify function can't find ejs
This works fine locally but when I run in Netlify lambda function I see errors in the function logs:
Error: Failed to lookup view "layouts/layout" in views directory "/render"
Why does the path get set incorrectly?
[Update: I forgot to mention that I’m using netlify-lambda to build the app for deployment, so all the modules should be available in the lambda function, right?]