sahat / hackathon-starter

A boilerplate for Node.js web applications
MIT License
34.89k stars 8.18k forks source link

Server Error #997

Closed MatteoGauthier closed 5 years ago

MatteoGauthier commented 5 years ago

Response

Server Error

cf-ray: 501949b978f8cdb7-CDG
content-type: text/html; charset=utf-8
date: Mon, 05 Aug 2019 13:58:48 GMT
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
status: 500
vary: Accept-Encoding
via: 1.1 vegur
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
YasharF commented 5 years ago

How did you get this error?

MatteoGauthier commented 5 years ago

⬇️⬇️⬇️ hackathon boilerplate issue 1

YasharF commented 5 years ago

Looking into this.

I see the following error in the server logs

2019-08-05T17:43:15.840240+00:00 app[web.1]: TypeError: req.assert is not a function
2019-08-05T17:43:15.840265+00:00 app[web.1]: at exports.postTwitter (/app/controllers/api.js:284:7)
2019-08-05T17:43:15.840268+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2019-08-05T17:43:15.840271+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2019-08-05T17:43:15.840273+00:00 app[web.1]: at exports.isAuthorized (/app/config/passport.js:696:7)
2019-08-05T17:43:15.840275+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2019-08-05T17:43:15.840277+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2019-08-05T17:43:15.840279+00:00 app[web.1]: at exports.isAuthenticated (/app/config/passport.js:649:12)
2019-08-05T17:43:15.840282+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2019-08-05T17:43:15.840284+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2019-08-05T17:43:15.840286+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2019-08-05T17:43:15.840288+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2019-08-05T17:43:15.840290+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:281:22
2019-08-05T17:43:15.840292+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2019-08-05T17:43:15.840294+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2019-08-05T17:43:15.840295+00:00 app[web.1]: at serveStatic (/app/node_modules/serve-static/index.js:75:16)
2019-08-05T17:43:15.840297+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2019-08-05T17:43:15.840298+00:00 app[web.1]: at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
2019-08-05T17:43:15.840300+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:7
2019-08-05T17:43:15.840302+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2019-08-05T17:43:15.840303+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2019-08-05T17:43:15.840305+00:00 app[web.1]: at /app/app.js:116:3
2019-08-05T17:43:15.840306+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2019-08-05T17:43:15.840308+00:00 app[web.1]: at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
2019-08-05T17:43:15.840309+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:7
2019-08-05T17:43:15.840311+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2019-08-05T17:43:15.840312+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2019-08-05T17:43:15.840314+00:00 app[web.1]: at /app/app.js:102:3
2019-08-05T17:43:15.840315+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2019-08-05T17:43:15.845035+00:00 app[web.1]: POST /api/twitter 500 8.645 ms - 12
YasharF commented 5 years ago

Oh, I see. The issue is req.assert in that line. The bug was introduced by https://github.com/sahat/hackathon-starter/commit/8f79ae169153b414d418756e725579815d9f589e which replaced express-validator with validatorjs.

Working on this right now.

YasharF commented 5 years ago

Fixed with https://github.com/sahat/hackathon-starter/commit/64a390c6d9ef218d680e2068b145d534f8607a73