get-iptc-pmd
get-iptc-pmd copied to clipboard
Not work with Linux + Nginx
Hello, I have installed the app and it run normally, but when I click Get Photo Metadata of Web Image button, I get this error, then I got 504 Gateway Time-out nginx page. Is it a bug?
[user@localhost]# npm -v
5.8.0
[user@localhost]# node -v
v9.10.1
[user@localhost]# npm start
> [email protected] start /home/user/get-iptc-pmd
> node ./bin/www
GET / 302 16.560 ms - 76
GET /getiptcpmd.html 304 2.395 ms - -
GET /stylesheets/bootstrap.min.css 304 0.627 ms - -
GET /stylesheets/style_wbs.css 304 0.370 ms - -
GET /javascripts/spin.min.js 304 0.660 ms - -
GET /images/logo.jpg 304 0.469 ms - -
START: processRequest
(node:2851) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'ip' of undefined
at Object.write2Log (/home/user/get-iptc-pmd/services/tools1.js:12:22)
at ep.open.then.then.catch.err (/home/user/get-iptc-pmd/services/processimage.js:298:16)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:118:7)
(node:2851) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2851) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
GET `/getmd/html/stds/ipmd` - - ms - -
config/appconfig.json
{
"app" : {
"localImageDir" : "/home/user/get-iptc-pmd/public/testimages/",
"webserverImageDir" : "/home/user/get-iptc-pmd/public/testimages/",
"uploadDir" : "/home/user/get-iptc-pmd/public/testimages/",
"defaultimageFname" : "IPTC-PhotometadataRef-Std2017.7.jpg",
"defaultimageLabel": "IPTC Photo Metadata Standard 2017.7 reference photo",
"localLogFpath" : "/home/user/get-iptc-pmd/getIptcPmd.log",
"logLevel" : 1,
"minMetadataHeaderSize": 71680
}
}
I've tested this app on Ubuntu 16.04 with Apache 2.4 and the LTS versions of Node.js in 6.x and 8.x. The shown error indicates that the http request object is missing (is "undefined") as the function write2Log has "req" as parameter and line 12 processes the property req.ip
A quick workaround could be to comment out the code lines of write2Log in /services/tools1.js. But as the http request is used at many other locations this may not be a solution.