Ardakilic / alerthub

AlertHub is a simple tool written with NodeJS to get alerted from new GitHub and GitLab repository events.
MIT License
194 stars 12 forks source link

"__dirname is not defined" on trying to consume RSS feed #59

Closed AlbertCaro closed 1 year ago

AlbertCaro commented 1 year ago

I have found another bug after update to 2.2.1 release:

Application booted at Mon, 26 Sep 2022 05:03:53 GMT
AlertHub RSS Feed server running at port 3444
file:///usr/src/app/src/utils/rss.js:114
        plugins_directories: [path.join(__dirname, '..', 'plugins', 'rss-braider')],
                                        ^

ReferenceError: __dirname is not defined
    at RssUtils.createRSSFeed (file:///usr/src/app/src/utils/rss.js:114:41)
    at Server.<anonymous> (file:///usr/src/app/src/index.js:144:14)
    at Server.emit (node:events:513:28)
    at parserOnIncoming (node:_http_server:1034:12)
    at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17)

And again, thank you in advance for your help.

reconman commented 1 year ago

Was caused by the migration to ES modules: https://stackoverflow.com/a/62892482

reconman commented 1 year ago

Wasn't familiar with the RSS code. Alerthub only used the RSS configuration when you sent a request to localhost:3444.

In my commit, I changed it so it fails on startup and I had to revert a few of the changes from #57.

You will need to change back the config.js to the old format of module.exports = when using version 2.2.2.