How to fix Uncaught TypeError: Cannot read property in phoenix

Hello, I want to use google recaptcha in my phoenix site, but I have the errors when I try to use it

[Violation] Forced reflow while executing JavaScript took 84ms
Uncaught TypeError: Cannot read property 'postMessageId' of null
    at onPostMessage (iframe.js:1000)
iframe.js:1000 Uncaught TypeError: Cannot read property 'postMessageId' of null
    at onPostMessage (iframe.js:1000)

for example I loaded its Js in my phoenix app.html.eex before closing </head> like this:

  <script src='' async defer></script>

after this I imported its html code in my templates/user/login.html.eex file , like this:

<%= form_for @conn, user_path(@conn, :login_register_sender), fn f -> %>
    <div class="form-group">
      <label for="email">ایمیل</label>
      <%= email_input f, :email, class: "form-control", id: "login-email", autocomplete: "email", aria_describedby: "emailHelp", required: "" %>
      <small id="emailHelp" class="form-text text-muted">ایمیل شما با هیچ فرد و گروهی به اشتراک گذاشته نخواهد شد.</small>

    <div class="form-group">
      <label for="password">پسورد</label>
      <%= password_input f, :password, class: "form-control", id: "passinput", autocomplete: "password", required: "" %>

    <div class="recap">
      <div class="g-recaptcha" data-sitekey="6LcSiW8UAAAAAPMAopdGZVFS22JyeWLUZGi9bvQu"></div>

    <%= submit "ارسال", class: "btn btn-primary" %>
  <% end %>

my code works but I have those errors, how to fix this, I tried to use recaptcha lib, but even this lib had the errors.

Ahh, this error is for the sake of Wappalyzer app in chrome :frowning_face::sweat:

1 Like