Code Monkey home page Code Monkey logo

Comments (4)

akhoury avatar akhoury commented on June 27, 2024

Weird, ..

could you put a log statement right before the parse statement on line 44

   response.on('end', function() {
      console.log(options, body); // add this one

      // also to prevent the crash you wrap it with a try/catch
      var data = {};
      try{ data = JSON.parse( body ); }
      catch (e) {}

      if (!data.success) return cb(new Error(data['error-codes']));
      cb(null);
    });

the simple-recaptcha module that I'm using a fork, so we can't create issues but we can create pull requests if you can help me debug the issue

Remember to obfuscate your private key if it shows up in the logs

from nodebb-plugin-spam-be-gone.

ananace avatar ananace commented on June 27, 2024

Changes have been applied and I've activated recaptcha again, I'll report back once I get another error.

from nodebb-plugin-spam-be-gone.

ananace avatar ananace commented on June 27, 2024

There we go, now I have an update for you;

{ host: 'www.google.com',
  port: 443,
  path: '/recaptcha/api/siteverify?secret=REDACTED &remoteip=REDACTED&response=REDACTED',
  method: 'GET',
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' } } '<!DOCTYPE html>\n<html lang=en>\n  <meta charset=utf-8>\n  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">\n  <title>Error 400 (Bad Request)!!1</title>\n  <style>\n    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}\n  </style>\n  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>\n  <p><b>400.</b> <ins>That’s an error.</ins>\n  <p>Your client has issued a malformed or illegal request.  <ins>That’s all we know.</ins>\n'
Error:  [SyntaxError: Unexpected token <]

I think the problem is that a space seems to have appeared at the end of my private key, no idea when this happened though since I haven't touched the keys since first adding them when installing the plugin...

Maybe something to check, just to be sure. Strip spaces from the value when saving, if they're going to be fed directly into a request URI later on.

from nodebb-plugin-spam-be-gone.

akhoury avatar akhoury commented on June 27, 2024

ah ok, thanks, I will also add a try/catch block in the core so it won't crash the server.

from nodebb-plugin-spam-be-gone.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.