magento2: Braintree javascript error on Chrome: Uncaught TypeError: FormNapper requires an HTMLFormElement element or the id string of one

On a regular basis I am not able to enter Braintree (sandbox) credit card details in the checkout form when using Chrome, it also shows the following javascript error:

js.braintreegateway.com/js/braintree-2.17.6.min.js:4 Uncaught TypeError: FormNapper requires an HTMLFormElement element or the id string of one.

Just confirmed that I also get this error in a fresh vanilla installation of Magento CE 2.1.0.

Steps to reproduce

  1. Install Magento-CE-2.1.0_sample_data-2016-06-23-02-34-56
  2. Create a Braintree Sandbox account & enable Braintree in Magento backend (make sure you set merchant country)
  3. Add product to cart, enter shipping details and on Review & Payments page select “Credit Card (Braintree)”

Expected result

  1. Being able to enter credit card details

Actual result

  1. Can’t enter data in any of the credit card form fields
  2. Console shows the following error:

js.braintreegateway.com/js/braintree-2.17.6.min.js:4 Uncaught TypeError: FormNapper requires an HTMLFormElement element or the id string of one.

Note that I am not able to reproduce this all the time, I seem to get it sometimes & sometimes I don’t see the error. I can usually make it re-appear by deleting browser history. I am using Chromium Version 51.0.2704.79 Ubuntu 15.10 (64-bit) but have seen the problem on Windows Chrome as well.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

@LucScu I’ve created a ticket #6827 about that case with my solution. It works on our installation. Feel free to review it.