seo icon indicating copy to clipboard operation
seo copied to clipboard

Switching entry type goes wrong, POST index.php?p=admin/actions/seo/seo/render-data 500 (Internal Server Error)

Open kevinmu17 opened this issue 5 years ago • 1 comments

Description

I have a structure with 2 entry types, 1 contains the SEO field and 1 doesn't. When creating a new entry it opens the first 1 by default with the seo field, but when i switch to the 2nd entry type it throws this error ` jquery.js:10099 POST DOMAIN.COM/index.php?p=admin/actions/seo/seo/render-data 500 (Internal Server Error) send @ jquery.js:10099 ajax @ jquery.js:9682 postActionRequest @ Craft.js:508 (anonymous) @ Snippet.js:334 _renderTokens @ Snippet.js:325 (anonymous) @ Snippet.js:231 l @ debounce.js:46 setTimeout (async) (anonymous) @ debounce.js:50 l @ debounce.js:46 setTimeout (async) (anonymous) @ debounce.js:50 attributes (async) addClass @ jquery.js:8297 (anonymous) @ DraftEditor.js:656 u @ jquery.js:3496 fireWith @ jquery.js:3626 S @ jquery.js:9786 (anonymous) @ jquery.js:10047 load (async) send @ jquery.js:10066 ajax @ jquery.js:9682 postActionRequest @ Craft.js:508 (anonymous) @ DraftEditor.js:655 saveDraft @ DraftEditor.js:625 checkForm @ DraftEditor.js:608 setTimeout (async) (anonymous) @ DraftEditor.js:126 (anonymous) @ garnish.js:893 o @ jquery.js:10771 dispatch @ jquery.js:5429 v.handle @ jquery.js:5233

Snippet.js:237 Uncaught (in promise) TypeError: Cannot read property 'hasOwnProperty' of null at MutationObserver. (Snippet.js:237) It feels like the SEO plugin is adding some kind of event listener / observer to the page but doesn't get unset when switching to another entry type. I found something in the **vendor/ether/seo/src/web/assets/js/seoField.min.js** when beautified it's line 3013 - 3028 async _renderTokens() { return new Promise(e => { const o = $(this.mainForm).serializeArray().reduce((e, o) => (e[o.name] = o.value, e), {}); o.hasOwnProperty("action") && delete o.action, Craft.postActionRequest("seo/seo/render-data", function (e) { for (var o = 1; o < arguments.length; o++) { var s = null != arguments[o] ? arguments[o] : {}; o % 2 ? g(Object(s), !0).forEach((function (o) { n()(e, o, s[o]) })) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(s)) : g(Object(s)).forEach((function (o) { Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(s, o)) })) } return e }({}, this.SEO.options.renderData, {}, o), e) }) } `

Steps to reproduce

  1. Create a structure in craft > add 2 entry types > add the SEO plugin to only 1 of the entry types
  2. Create an entry via entries in the created structure, now switch entry types in the right side menu of Craft CMS.

Additional info

  • Craft version: Craft Pro 3.5.9
  • SEO version: 3.6.6
  • PHP version: 7.3.22
  • Database driver & version: mariaDB 10.3.23
  • Other Plugins: N/A

kevinmu17 avatar Sep 11 '20 13:09 kevinmu17

I was experiencing this same issue on an entry that contained a lot of data. Turns out I was hitting the PHP Max Input Vars limit as all that data was being passed to admin/actions/seo/seo/render-data. It was detailed in my PHP error log, so might be worth looking there for more info?

bendesilva avatar Sep 16 '20 13:09 bendesilva