monarch-initiative / monarch-legacy

Monarch web application and API
BSD 3-Clause "New" or "Revised" License
42 stars 37 forks source link

Errors reported by GrayLog #1239

Open jnguyenx opened 8 years ago

jnguyenx commented 8 years ago

This is a dump of the reported log errors. I don't think that they're all relevant, some should be silent.

Debug: internal, implementation, error 
    TypeError: Uncaught error: Cannot read property 'Content-Disposition' of undefined
    at wrapResponse (/opt/monarch-app/lib/monarch/web/webenv.js:289:35)
    at /opt/monarch-app/lib/monarch/web/webenv.js:385:25
    at /opt/monarch-app/node_modules/wait.for/waitfor.js:15:31
errorResponse:Cannot find apple-touch-icon (404)
Stack trace=Error
    at errorResponse (/opt/monarch-app/lib/monarch/web/webapp.js:775:19)
    at notFoundResponse (/opt/monarch-app/lib/monarch/web/webapp.js:794:12)
    at Object.resolveByIdHandler (/opt/monarch-app/lib/monarch/web/webapp.js:5353:22)
    at /opt/monarch-app/lib/monarch/web/webenv.js:384:52
    at /opt/monarch-app/node_modules/wait.for/waitfor.js:15:31
errorResponse:Cannot find apple-touch-icon-precomposed (404)
Stack trace=Error
    at errorResponse (/opt/monarch-app/lib/monarch/web/webapp.js:775:19)
    at notFoundResponse (/opt/monarch-app/lib/monarch/web/webapp.js:794:12)
    at Object.resolveByIdHandler (/opt/monarch-app/lib/monarch/web/webapp.js:5353:22)
    at /opt/monarch-app/lib/monarch/web/webenv.js:384:52
    at /opt/monarch-app/node_modules/wait.for/waitfor.js:15:31
Debug: internal, implementation, error 
    Error: Uncaught error: ENOENT: no such file or directory, open './dist/app.26a4249946448350be6b.css'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at Object.fs_readFileSync (/opt/monarch-app/lib/monarch/serverenv.js:23:37)
    at Object.wrapContent (/opt/monarch-app/lib/monarch/web/webenv.js:358:24)
    at Object.<anonymous> (/opt/monarch-app/lib/monarch/web/webapp.js:1178:24)
    at /opt/monarch-app/lib/monarch/web/webenv.js:384:52
    at /opt/monarch-app/node_modules/wait.for/waitfor.js:15:31
jmcmurry commented 8 years ago

@jnguyenx any update on this? I'm not sure what it means

jnguyenx commented 8 years ago

These are errors thrown on the monarch-app side reported by GrayLog. I showed that to @DoctorBud and most of them should be silent. The one with the dist/app comes from Webpack but it is unsure how to get rid of that.

Investigations haven't gone further because of lack of time and resources, but these have to be eventually resolved in order to have a proper alert notification system.

DoctorBud commented 8 years ago

The ENOENT occurs because there are browsers who cached an older index.html that refers to an older /dist/app.HEXHEXHEX.js, but that older file has been obsoleted and is no longer available. This is a good thing, called cache-busting. What is not good is the wasted graylog space.

The fix is to modify webenv.js wrapContent() method to check for file existence rather than throwing a noisy exception:

Current:

    function wrapContent(filePath) {
        var fileInfo = getFileInfo(filePath);
        var ctype = fileInfo.mimeType;
        var output = 'Unknown encoding for: ' + filePath;
        if (fileInfo.encoding === 'utf8') {
          output = env.fs_readFileSync(filePath) + '';
        }
        else if (fileInfo.encoding === 'binary') {
          output = env.fs_readFileSyncBinary(filePath);
        }

We really should consider moving our static content so that it is delivered via nginx instead of pup_tent. It would be much faster and would lighten the load on the app server a ton.

DoctorBud commented 8 years ago

I address all of these issues in https://github.com/monarch-initiative/monarch-app/pull/1374, which may allow this ticket to be closed after that PR is merged.