akhoury / nodebb-plugin-spam-be-gone

yup
MIT License
24 stars 25 forks source link

Getting "getaddrinfo ENOTFOUND" with Akismet Enabled #44

Closed singhnsk closed 8 years ago

singhnsk commented 8 years ago

The plugin is enabled, Akismet APKI key entered, Akismet enabled. When a user tries to create a new topic or reply to a topic, the following error is thrown and the post/topic is not submitted.

ERROR
getaddrinfo ENOTFOUND 
4ce6341214.rest.akismet.com 
4ce6341214.rest.akismet.com:80

The following screenshot shows the error displayed: 2015-11-19_0-06-20

It could be my server configuration, but it could be something with the source code. I found one more user facing this and he opened a topic at nodeBB community with no replies - https://community.nodebb.org/topic/6549/error-getaddrinfo-enotfound/2

akhoury commented 8 years ago

@singhnsk im unable to test at the moment, but can you try to change this line /path/to/your/nodebb/node_modules/nodebb-plugin-spam-be-gone/library.js Line 182

From

    permalink: nconf.get('url') + 'topic/' + data.permalink,

To

    permalink: nconf.get('url').replace(/\/$/, '') + '/topic/' + data.permalink,

https://github.com/akhoury/nodebb-plugin-spam-be-gone/blob/aeee9844327806b030c698f02ed6d8f092fbf827/library.js#L182

singhnsk commented 8 years ago

So.. I did that and now the posts do get submitted. GREAT! But, I tried posting some SPAM and it appeared right there on the forum. May I know how this plugin is supposed to work? Does it block spam posts, put the post under some sort of moderation or just let it be posed? Sorry but the description says nothing about how it is supposed to work. In short, I'm not convinced that it is active and functional after that edit.

singhnsk commented 8 years ago

I tried to test and used the same text with the Akismet module and it returned that the submitted text is spam. I used the following test script in a file named check.js:

var akismet = require('akismet').client({ blog: 'URL', apiKey: 'API KEY' });

akismet.verifyKey(function(err, verified) {
    console.log('Verifying API Key')
  if (verified) 
    console.log('API key successfully verified.');
  else 
    console.log('Unable to verify API key.');
});

akismet.checkSpam({ 
    user_ip: '1.1.1.1', 
    permalink: 'URL of COMMENT POST',
    comment_author: 'TESTER',
    comment_content: 'noted orchidologist.Mr. Jimmie Giles is a resident of and is domiciled in the State of Florida.6. for all practical purposes, based on that same theory.No scheduled talks for NHL, NHLPALast week the do it. Speaking of Hixon, he is listed as probable for tomorrow’s game, meaning he should past a lengthy time..Not pressurize your children to learn anything. And also at the end of receivers while they were unaware of their surroundings. With the new rule in place, receivers will http://owtk.com/wp-content/cheap-elite-jerseys.html]cheap elite jerseys cheap elite jerseys'
  }, function(err, spam) {
    console.log('Checking the submitted comment for spam')
    if(spam)
      console.log('Spam caught.');
    else
      console.log('Not spam');
});

And the result was:

user@ip-172-31-xx-xx:~/path_to_nodeBB/node_modules/nodebb-plugin-spam-be-gone/node_modules/akismet$ node check.js
Verifying API Key
API key successfully verified.
Checking the submitted comment for spam
Spam caught.

So, the Akismet module is able to make a proper request to Akismet and check for spam. So, I don't think this is an issue of server blocking outgoing requests. Now I wonder what else is wrong with the spam-be-gone plugin.

singhnsk commented 8 years ago

Sorry for the confusion. It appears to me that the same error persists. Apparently I decided to restart NodeBB after changing the settings and it still needed a reload. Upon reload which I did now, the same error pops up while trying to post something.

akhoury commented 8 years ago

@singhnsk we don't really control how Akismet decides if the post is a SPAM or not. Also, your test is NOT identical to our plugin's, we pass Akismet more info, like the user-agent, the current topic url (so it can parse the relevant page), along with the rest of the params you passed in.

Anyways, not sure, published an update to spam-be-gone on npm, you should update that plugin, then restart your nodebb instance.

give it a try and let us know.

singhnsk commented 8 years ago

Just tried and it still throws the same error.

With my test, I didn't mean to entirely roll out the chance of it being a server configuration issue, but just that there are now lesser chances of it being that.

Do you have some idea what else could be causing it?

akhoury commented 8 years ago

@singhnsk I am still not able to reproduce the issue, but i did find another bug, could be the cause of what you're seeing and I did update the Akismet module, can you do try again against master before I publish?

cd /path/to/your/NodeBB/
npm rm nodebb-plugin-spam-be-gone
npm install https://github.com/akhoury/nodebb-plugin-spam-be-gone/tarball/master
./nodebb start
akhoury commented 8 years ago

also, which version of NodeBB are you using?

singhnsk commented 8 years ago

Hi @akhoury It now says:

ERROR
Invalid URI "http:///%204c7ae6341214.rest.akismet.com:80/1.1/comment-check"
akhoury commented 8 years ago

fix your api key, it has a space at the beginning, which encodes to %20. this should look

http://4c7ae6341214.rest.akismet.com:80/1.1/comment-check"
singhnsk commented 8 years ago

Hah! Such a silly mistake made there. Sorry about that man. It works fine now. You can publish the fix to the latest :) screenshot_2015-11-20-14-10-01

akhoury commented 8 years ago

done, published nodebb-plugin-spam-be-gone@0.4.5 - however, if you install a fresh copy of NodeBB you're gonna get the 0.4.3 version, so if you do that, you need to update it either from the Admin panel or

cd /path/to/NodeBB
npm rm nodebb-plugin-spam-be-gone
npm install nodebb-plugin-spam-be-gone@0.4.5