Title: 5.4 JS Errors When Deferring JS
Last modified: March 29, 2021

---

# 5.4 JS Errors When Deferring JS

 *  [golden3599](https://wordpress.org/support/users/golden3599/)
 * (@golden3599)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/5-4-js-errors-when-deferring-js/)
 * After upgrading to 5.4 all of our sites with WP-Rocket JS deferred optimization
   in place are displaying JS console errors. Reverting back to 5.3 resolves the
   issue.
 * Does anyone have a fix for this issue besides not deferring JS?
 * Uncaught TypeError: Cannot read property ‘use’ of undefined:
    wp.apiFetch.use(
   wp.apiFetch.createRootURLMiddleware( “[https://www.domainremoved.com/wp-json/&#8221](https://www.domainremoved.com/wp-json/&#8221);));
 * refill 404 error:
    api-fetch.min.js?ver=4dec825c071b87c57f687eb90f7c23c3:2 GET/
   contact/contact-form-7/v1/contact-forms/4296/refill?_locale=user 404
 * Invalid JSON error:
    {code: “invalid_json”, message: “The response is not a valid
   JSON response.”}code: “invalid_json”message: “The response is not a valid JSON
   response.”__proto__: constructor: ƒ Object()hasOwnProperty: ƒ hasOwnProperty()
   isPrototypeOf: ƒ isPrototypeOf()propertyIsEnumerable: ƒ propertyIsEnumerable()
   toLocaleString: ƒ toLocaleString()toString: ƒ toString()valueOf: ƒ valueOf()__defineGetter__:
   ƒ __defineGetter__()__defineSetter__: ƒ __defineSetter__()__lookupGetter__: ƒ
   __lookupGetter__()__lookupSetter__: ƒ __lookupSetter__()get __proto__: ƒ __proto__()
   set __proto__: ƒ __proto__() (anonymous) @ index-540bf1359d7e987a0de0528a844b1482.
   js:1 Promise.catch (async) p @ index-540bf1359d7e987a0de0528a844b1482.js:1 (anonymous)@
   index-540bf1359d7e987a0de0528a844b1482.js:1 (anonymous) @ index-540bf1359d7e987a0de0528a844b1482.
   js:1 load (async) b @ index-540bf1359d7e987a0de0528a844b1482.js:1 (anonymous)@
   index-540bf1359d7e987a0de0528a844b1482.js:1 (anonymous) @ index-540bf1359d7e987a0de0528a844b1482.
   js:1`

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/5-4-js-errors-when-deferring-js/#post-14107606)
 * Where can we see the website in question?
 *  Thread Starter [golden3599](https://wordpress.org/support/users/golden3599/)
 * (@golden3599)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/5-4-js-errors-when-deferring-js/#post-14107688)
 * Linked below is a demo site with just CF7 and WP-Rocket plugins activated. WP-
   Rocket is set to combine and defer JS.
 * [http://demosite.ylxdr1raaw-pxr4kmom26gn.p.runcloud.link/](http://demosite.ylxdr1raaw-pxr4kmom26gn.p.runcloud.link/)
 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/5-4-js-errors-when-deferring-js/#post-14109074)
 * This is definitely WP-Rocket’s failure. As WP-Rocket is a commercial plugin that
   isn’t distributed from wordpress.org, [we can’t help you in these support forums](https://wordpress.org/support/guidelines/#do-not-post-about-commercial-products).
   Contact the plugin seller for support.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘5.4 JS Errors When Deferring JS’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 3 replies
 * 14 participants
 * Last reply from: [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/5-4-js-errors-when-deferring-js/#post-14109074)
 * Status: not resolved