• Resolved coleclark

    (@coleclark)


    We have an up-to-date WPMU install on WPEngine, that uses a custom theme that itself uses Block Lab 1.5.0. It works great, except for one particular bug that we can’t figure out:

    When creating a new post with a so-called WYSIWYG block, the main text/content portion is built using a content field, like this: block_field(‘content’, false);

    99% of the time it works great. But when our users enter text with the word “script” in it (like “description” or “subscription”) to that field and clicks out of it to close the editor and display the page, the block shows a gray box with the text “Error loading block: The response is not a valid JSON response.” In the console, api-fetch.js returns a 403 error. The request string can be found here:

    https://pastebin.com/xcbveu2T

    If the user clicks back into the block, the editor shows that the original text is still there, and on publishing the original correct text is published, so it’s just the block UI that’s having the problem.

    We’ve tried turning off plugins and all the usual stuff. The currently installed and enabled plugins are: AddToAny Share Buttons, Advanced Custom Fields PRO, Advanced Gutenberg Blocks, Better Search Replace, Block Lab, Compress JPEG & PNG images, Custom Post Type UI, Disable Gutenberg Blocks – Block Manager, Lazy Load by WP Rocket, Public Post Preview, WP Add Custom CSS, WP Rocket, WP2Static, and Yoast SEO.

    Have you all ever seen anything like this? If not, any ideas on what to try next?

    • This topic was modified 6 years, 2 months ago by coleclark.
    • This topic was modified 6 years, 2 months ago by coleclark.
    • This topic was modified 6 years, 2 months ago by coleclark. Reason: Trying to format the code so that it's readable
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Ryan Kienstra

    (@ryankienstra)

    Hi @coleclark,
    Thanks for bringing this up, and sorry for the delay.

    1. Would you be able to upgrade to Block Lab 1.5.3 and see if this still occurs?
    2. Thanks a lot for the pastebin of the request. Could you please share a screenshot of the block with the issue in the block editor? Seeing the exact text would help. I didn’t see this when using a Classic Text field:

    https://cldup.com/xcfdC_SrYi.png

    Thanks!

    Thread Starter coleclark

    (@coleclark)

    Hi @ryankienstra, thanks for getting back to me.

    1. Here’s a screenshot of the block editing screen showing the error: https://snipboard.io/EmyhbB.jpg
    2. Here’s a screenshot of the block editor for the individual block, where you can see the offending word (“Subscription”): https://snipboard.io/8TUgQM.jpg
    3. And here is a preview of the page, as you can see it doesn’t appear to block publication of the text: https://snipboard.io/Lfpr9U.jpg
    4. Finally, here’s a pastebin of the theme block template for the block that’s showing the error (may not be useful, but for completeness): https://pastebin.com/HNiwaPyR

    I’ll try the upgrade as soon as I can and report back.

    No worries on any delay, I appreciate your attention. This is a weird one!

    Thread Starter coleclark

    (@coleclark)

    Just tried updating the plugin. The editor page is now blank except for the headline, and got this error in the console:
    Uncaught TypeError: Cannot set property ServerSideRender of #<Object> which has only a getter with this set of paths:

    at Module.<anonymous> (editor.blocks.js?ver=576e828a2b0106d7910c36aaa487e44c:formatted:2043)
    at n (editor.blocks.js?ver=576e828a2b0106d7910c36aaa487e44c:formatted:11)
    at editor.blocks.js?ver=576e828a2b0106d7910c36aaa487e44c:formatted:71
    at editor.blocks.js?ver=576e828a2b0106d7910c36aaa487e44c:formatted:72
    (anonymous) @ editor.blocks.js?ver=576e828a2b0106d7910c36aaa487e44c:formatted:2043
    n @ editor.blocks.js?ver=576e828a2b0106d7910c36aaa487e44c:formatted:11
    (anonymous) @ editor.blocks.js?ver=576e828a2b0106d7910c36aaa487e44c:formatted:71
    (anonymous) @ editor.blocks.js?ver=576e828a2b0106d7910c36aaa487e44c:formatted:72

    The plugin update doesn’t work for us at all, so we’ll be rolling it back to 1.5.0.
    FWIW I believe we’re on WP 5.3.1, though WordPress makes that difficult to determine.

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Hi @coleclark,
    Thanks, sorry to hear about that error.

    Thanks for all of your pastebins, they should really help.

    What kind of field is the ‘Content’ field? A Textarea field?

    The ‘Cannot set property ServerSideRender…’ error looks related to:
    https://github.com/WordPress/gutenberg/issues/18419

    …but I’m not sure of a solution, and I can’t reproduce it locally.

    I’ll look at that issue and the other one you mentioned.

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Would you be able to test this possible fix for the error Uncaught TypeError: Cannot set property ServerSideRender...

    https://github.com/getblocklab/block-lab/pull/520#issuecomment-596789487

    Thanks!

    Thread Starter coleclark

    (@coleclark)

    @ryankienstra

    Thanks for looking in to this, and for all the info, I really appreciate it.

    1. What type of field is a content field? I looked it up in the Block Labs “All Blocks” tab, found the “WYSIWYG” block, clicked Edit, and apparently the Content block is a “Classic Text” block. I tried changing it to a few other types (Text, TextArea, RichText) but the error still appeared.

    2. Thanks for the link to that bug report, I think it may be the source of our problem. At the very least, if we can’t figure it out it gives me something to point to and say “Wait for a WP update.”

    3. Thanks for the new build! I tried it on our staging server, and unfortunately got the same result as my last update from yesterday. If you’re curious, here’s the error (same as before) captured straight from Dev Tools: https://snipboard.io/TSikMm.jpg

    Unless you can think of something else (I can’t), I think that’s about as far as we can go. Thanks again, Ryan, and if it resolves itself following a WP or BL update, I’ll let you know!

    Best regards,
    Henry

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Hi @coleclark,
    Thanks for all of your details, and for the snipboard of the console error.

    Sorry for yet another question, but what browser and operating system is it in?

    Thread Starter coleclark

    (@coleclark)

    @ryankienstra Haha, no problem at all 🙂

    I’ve tested on Chrome 80.0.3987.132, and Firefox 73.0.1, on MacOS Mojave (10.14.6).

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    OK, thanks. So that error Uncaught TypeError: Cannot set property ServerSideRender of #<Object> which has only a getter

    is happening in a lot of browsers.

    • This reply was modified 6 years, 2 months ago by Ryan Kienstra.
    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Hi @coleclark,
    Sorry for the delay again.

    It’s interesting there was a 403 (forbidden) error for that error ‘Error loading block: The response is not a valid JSON response.’

    You’ve tried deactivating all plugins, but is there any more security infrastructure that might have blocked the request?

    It looks like fetch doesn’t help with a clear error message:
    https://github.com/WordPress/gutenberg/blob/03960e671cca1afee4f6ebbf20d0bdaf2170e672/packages/api-fetch/src/index.js#L87-L89

    I couldn’t reproduce this. Feel free to comment if these steps aren’t right:

    Steps to reproduce
    1. cd path/to/block-lab
    2. git checkout 4b1dd7f87da2baa80838c17b44c4daf4982800d1 # the 1.5.0 bump commit
    3. composer install && npm install && npm run dev
    4. Create a WYSIWYG block:
    https://cldup.com/rpmyhYBI61.png
    5. Past this into blocks/block-wysiwyg.php:
    https://pastebin.com/HNiwaPyR
    6. Create a new post
    7. Add the WYSIWYG block
    8. Populate the Content field (Classic Text) with:
    `WYSIWYG Subscription paragraph
    9. Select ‘Preformatted’:
    https://cldup.com/G6WFXrG43L.png
    10. Click somewhere else so the preview (ServerSideRender) displays
    11. Expected: there’s no error in the preview, and the text displays
    12. Actual: same as expected:
    https://cldup.com/4nEJ5MkTBM.png

    Thanks for your patience!

    • This reply was modified 6 years, 2 months ago by Ryan Kienstra.
    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Sorry, maybe I’ve been using at-mentions too much.

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    This definitely could be an issue, but I’m closing now due to inactivity.

    Feel free to comment if you’d like it reopened.

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

The topic ‘JSON error in UI when using certain words’ is closed to new replies.