mrutkows commented on a change in pull request #113: Fix Node Express 'use()'
method by removing invalid 'err' parameter
URL:
https://github.com/apache/incubator-openwhisk-runtime-nodejs/pull/113#discussion_r260464045
##########
File path: core/nodejsActionBase/app.js
##########
@@ -38,7 +38,7 @@ app.use(bodyParser.json({ limit: "48mb" }));
app.post('/init', wrapEndpoint(service.initCode));
app.post('/run', wrapEndpoint(service.runCode));
-app.use(function(err, req, res, next) {
+app.use(function(req, res, next) {
console.error(err.stack);
Review comment:
If I hit the existing code with an POST/GET (etc.) to a bogus endpoint, I
get a default 404 error:
```
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /bad</pre>
</body>
</html>
Response code: 404 (Not Found); Time: 68ms; Content length: 143 bytes
```
if the intent is to immediately block all these bad requests immediately
this change results in
```
HTTP/1.1 500 Internal Server Error
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 24
ETag: W/"18-928jOLijreS3ro9mYfVt0IU4k/0"
Date: Tue, 26 Feb 2019 20:03:54 GMT
Connection: keep-alive
{
"error": "Bad request."
}
Response code: 500 (Internal Server Error); Time: 11928ms; Content length:
24 bytes
```
Trying to figure out the original intent and perhaps short circuit any
endpoint that is not intended to be part of the actual runtime.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services