boyney123 / garie-browsertime

Browsertime Garie plugin. Polls websites to checkout performance metrics also supports webhooks.
MIT License
7 stars 9 forks source link

Sub pages on a a URL do not work #1

Open eschaefer opened 5 years ago

eschaefer commented 5 years ago

Relevant code or config

garie-config.json

{
    "cron": "0 */4 * * *",
    "urls": [
        {
            "url": "https://www.eyeem.com",
            "report": true
        },
        {
            "url": "https://www.eyeem.com/u/gen",
            "report": true
        }
    ]
}

What you did:

Started garie with sh start.sh

What happened:

Domain sub-paths are not converted to safe characters for the file system:

| [2018-11-19 12:23:42] INFO: Wrote data to browsertime-results/www.eyeem.com-u-gen/2018-11-19T122255+0000
garie-browsertime_1         | Finished getting data for: https://www.eyeem.com/u/gen
garie-browsertime_1         | info: Finished getting data for https://www.eyeem.com/u/gen, trying to get the results {"timestamp":"2018-11-19T12:23:43.471Z"}
garie-browsertime_1         | { Error: ENOENT: no such file or directory, scandir '/usr/src/garie-browsertime/reports/browsertime-results/www.eyeem.com/u/gen'
garie-browsertime_1         |     at Object.fs.readdirSync (fs.js:904:18)
garie-browsertime_1         |     at getBrowserTimeFile (/usr/src/garie-browsertime/src/browser-time/index.js:19:28)
garie-browsertime_1         |     at ChildProcess.child.on (/usr/src/garie-browsertime/src/browser-time/index.js:46:36)
garie-browsertime_1         |     at emitTwo (events.js:126:13)
garie-browsertime_1         |     at ChildProcess.emit (events.js:214:7)
garie-browsertime_1         |     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
garie-browsertime_1         |   errno: -2,
garie-browsertime_1         |   code: 'ENOENT',
garie-browsertime_1         |   syscall: 'scandir',
garie-browsertime_1         |   path: '/usr/src/garie-browsertime/reports/browsertime-results/www.eyeem.com/u/gen' }
garie-browsertime_1         | warn: Failed to get browsertime file for https://www.eyeem.com/u/gen {"timestamp":"2018-11-19T12:23:43.476Z"}
garie-browsertime_1         | (node:28) UnhandledPromiseRejectionWarning: Failed to get browsertime file for https://www.eyeem.com/u/gen

Reproduction repository:

Problem description:

Simple domain roots seem to work fine. Any path deeper than the domain root will throw the error mentioned above.

Suggested solution:

valentinab25 commented 5 years ago

Fixed this in the pull request - https://github.com/boyney123/garie-browsertime/pull/3