Support » Plugin: reCAPTCHA in WP comments form » Cannot read property ‘secret’ of null

  • Resolved nelgarbuzova

    (@nelgarbuzova)


    Today I noticed error in the console, when recaptcha initialized on the page with comments. If user is admin and recaptcha doesn’t initialize, then this error doesn’t shows.

    wp-embed.min.js?ver=4.9.8:1 Uncaught TypeError: Cannot read property 'secret' of null
        at a.wp.receiveEmbedMessage (wp-embed.min.js?ver=4.9.8:1)

    Month ago there is no this error. But today it is. I don’t do any updates in my blog for month, but why this error appears? I updated plug-in but althought got this error message.

    I read this theme about such error in other plugin (https://wordpress.org/support/topic/recaptcha-cannot-read-property-secret-of-null/?view=all) and it seeems that google changed some api for recaptcha. It is just my opinion, but I hope that kink to this theme may help you to find solution about why this error appears in plugin.

    • This topic was modified 2 years, 8 months ago by nelgarbuzova.
Viewing 15 replies - 1 through 15 (of 19 total)
  • Thread Starter nelgarbuzova

    (@nelgarbuzova)

    Text of error:

    wp-embed.min.js?ver=4.9.8:1 Uncaught TypeError: Cannot read property 'secret' of null
        at a.wp.receiveEmbedMessage (wp-embed.min.js?ver=4.9.8:1)
    Plugin Author jmviade

    (@jmviade)

    Hi, nelgarbuzova and dmullanpanda,

    Thanks for the report.

    Google, constantly, is changing its API so… Well, I will check out this issue and I’ll write (or correct) in a couple of days, I hope so. 🙂

    • This reply was modified 2 years, 8 months ago by jmviade.
    Plugin Author jmviade

    (@jmviade)

    Hi, again,

    I’m sorry but the issue is directly related with the javascript code of google generated when its recaptcha module is included in a page.

    To test this, I’ve disconected completely my plugin and I’ve manually included a ‘google recaptcha field’ directly inside a wp_post and I’ve obtained the same error. 🙁

    In fact, this is one of recent documented errors for most of wp plugins and other add-ons that use this external javascript code of google: this one, Contact form 7, etc…

    I’m sorry, I’ll keep investigating, perhaps there is a solution… And, of course, if you have new information about this error, please, feel free to send it to me.

    Thank’s in advance.

    Best regards,

    Joan Miquel

    @jmviade, I am getting the same error. Waiting for your response.

    Plugin Author jmviade

    (@jmviade)

    Hi, everybody,

    Today’ve been testing all possible scenarios and, as I said, this error is related to the javascript code of Google and not directly with the plugin, in any case, I hope they will correct this error as soon as possible however and, on the other hand, I’ve been testing the plugin again and again and despite this console error log, the plugin works perfectly and checks correctly the comments form so, knowing that it’s always better do not have got any message in console, for the moment you can trust in the plugin, while, we’ll expecting for a new release of google’s javascript code and, of course, I keep investigating for any alternative solution.

    Thanks for your pacience. If I have got any new information, I’ll start a new messages threat.

    Best,

    Joan Miquel Viadé

    jmviade, Thanks for the reply.
    Just to clarify, it happens in custom forms. When I use the following:
    do_action(‘google_invre_render_widget_action’);

    Thanks
    Swarup

    • This reply was modified 2 years, 7 months ago by swarups.
    Plugin Author jmviade

    (@jmviade)

    Hi, swarups,

    I’m sorry but It seems that there is a mistake because the action ‘google_invre_render_widget_action’ is not inside my plugin.

    Did you spel it correctly?

    Thanks, again.

    Joan Miquel

    I also am receiving the same error and when I use the recaptcha and then submit, I get the following notice on my screen:
    “Notice: Trying to get property ‘success’ of non-object in…”
    The form does not post to the database so it is just not working. Thank you for your work on this issue.
    Sincerely,
    Erik Robles

    Hey jmviade,

    Really sorry mate. I get the exact same issue. So the confusion happened. I missed the plugin name. Sorry again.

    Same. But still flummoxed about the issue so if you find out anything, we’d sure appreciate the info. Cheers.

    Plugin Author jmviade

    (@jmviade)

    Hi, erikrobles,

    Please, tell me something more about your installation (the plugin name, other installed plugins, theme, wp version, etc) because I’ve been doing a lot of tests and the plugin works perfectly despite of the console error however I see that’s not your case so I’m sure that there will be any other significant difference.

    Please, help me, to find out what is happening, with just the console error message it’s very difficult to understand where the issue could come from.

    Thanks in advance.

    Joan Miquel

    • This reply was modified 2 years, 7 months ago by jmviade.
    • This reply was modified 2 years, 7 months ago by jmviade.

    Hello and Thank you for helping me out. I have posted this on Github gist so if you can check out my code, that would be great. I wasn’t using a plugin so I know this does not fall under your scope but if you can see something I missed, I certainly would appreciate it. Thank you in advance.
    Sincerely,
    Erik Robles
    The link is Here:
    https://gist.github.com/ErikRobles/a97ac48d4f005d6ef20f5f440de253da

    Plugin Author jmviade

    (@jmviade)

    Thanks, erikrobles,

    I’ve tested the solucion that’s explained in,

    https://core.trac.wordpress.org/ticket/44832

    modifying directly the wp-embed.min.js and it works perfectly and the console error dissapears.

    Particulary, in the minified code I change this piece of code

     
         if(d.secret||d.message||d.value)
    

    for this piece of code

    
         if(!d||!(d.secret||d.message||d.value))return;
    

    (be carefull, the first one hasn’t got semicolon and the second one has got semicolon)

    However, I do not recommend changing the WP core code in any way, but wait for the final solution proposed for version 4.9.9 wp, above all, if we take into account the last message of the discussion thread,

    @robhenley: “I agree the check should be there but isn’t the issue the generic “message” event that both wp-embed.min.js and Recaptcha’s recaptcha__en.js are using? So receiveEmbedMessage is being called by Recaptcha without the proper arguments.”

    So, be patient, and wait… 🙂

    Thanks, erikrobles for your contribution and your example of code in github.

    Joan Miquel

    • This reply was modified 2 years, 7 months ago by jmviade.
    • This reply was modified 2 years, 7 months ago by jmviade.
    • This reply was modified 2 years, 7 months ago by jmviade.
    • This reply was modified 2 years, 7 months ago by jmviade.

    @jmviade Perhaps I didn’t articulate it well but I was trying to say that they’re two separate issues: 1) not checking for null 2) the generic “message” event that should be something like “wp_message” instead to avoid event name collisions.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Cannot read property ‘secret’ of null’ is closed to new replies.