Parse-server: TypeError: res.sendFile is not a function

Created on 18 Mar 2016  路  4Comments  路  Source: parse-community/parse-server

For implementation related questions or technical support, please refer to the stackoverflow community.

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Environment Setup

Heroku + MongoLab

Steps to reproduce

I have deployed parse on Heroku and I'm able to call the all cloud functions.

When call with '/' it's working showing 'I dream of being a web site.'
But when I call https://myapp-dev2.herokuapp.com/test in browser, it showing error

app.get('/', function(req, res) {
  res.status(200).send('I dream of being a web site.');
});

app.get('/test', function(req, res) {
   //res.sendFile('/app/public/index.html');
   res.sendFile('public/index.html', { root: __dirname });
});

Logs/Trace

2016-03-18T15:12:54.734560+00:00 app[web.1]: TypeError: res.sendFile is not a function
2016-03-18T15:12:54.734603+00:00 app[web.1]:     at Object.handle (/app/index.js:68:8)
2016-03-18T15:12:54.734613+00:00 app[web.1]:     at next_layer (/app/node_modules/express/lib/router/route.js:103:13)
2016-03-18T15:12:54.734614+00:00 app[web.1]:     at Route.dispatch (/app/node_modules/express/lib/router/route.js:107:5)
2016-03-18T15:12:54.734615+00:00 app[web.1]:     at /app/node_modules/express/lib/router/index.js:205:24
2016-03-18T15:12:54.734615+00:00 app[web.1]:     at Function.proto.process_params (/app/node_modules/express/lib/router/index.js:269:12)
2016-03-18T15:12:54.734616+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/index.js:199:19)
2016-03-18T15:12:54.734616+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/index.js:176:38)
2016-03-18T15:12:54.734617+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/index.js:176:38)
2016-03-18T15:12:54.734617+00:00 app[web.1]:     at Layer.expressInit [as handle] (/app/node_modules/express/lib/middleware/init.js:23:5)
2016-03-18T15:12:54.734618+00:00 app[web.1]:     at trim_prefix (/app/node_modules/express/lib/router/index.js:240:15)

Most helpful comment

Update version to 4.8.0. Still getting error.

All 4 comments

From the express docs: res.sendFile() is supported by Express v4.8.0 onwards

I assume this is your issue, as it's not related to parse-server.

You can update your package json to require a newer version of express.

This was the fix!!! glad I found this.

Update version to 4.8.0. Still getting error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carjo422 picture carjo422  路  3Comments

sanergulec picture sanergulec  路  4Comments

AmbroiseCollon picture AmbroiseCollon  路  4Comments

shardul08 picture shardul08  路  3Comments

darkprgrmmr picture darkprgrmmr  路  4Comments