Can't Render Ninja Forms Preview With Sage 10, 504 Gateway Timeout

I have a Sage 10 theme and I can’t get the Ninja Forms previews to work. All they do is run forever and then just timeout? With any standard theme it renders fine. This breaks the previews from the Ninja Forms management area as well as in the Block Editor when placing a Ninja Forms block.

After waiting for it finally timeout on the preview I’m seeing the final errors:

[13-Jan-2023 21:12:24 UTC] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 4194312 bytes) in /var/www/html/web/wp-content/vendor/illuminate/view/FileViewFinder.php on line 137
[13-Jan-2023 21:12:24 UTC] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 2101248 bytes) in /var/www/html/web/wp/wp-includes/functions.php on line 5279
[13-Jan-2023 21:12:24 UTC] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 970752 bytes) in Unknown on line 0
[13-Jan-2023 21:13:07 UTC] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 4194312 bytes) in /var/www/html/web/wp-content/vendor/illuminate/view/FileViewFinder.php on line 137
[13-Jan-2023 21:13:08 UTC] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 2101248 bytes) in /var/www/html/web/wp/wp-includes/functions.php on line 5279
[13-Jan-2023 21:13:08 UTC] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 720896 bytes) in Unknown on line 0
[13-Jan-2023 21:13:20 UTC] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 4194312 bytes) in /var/www/html/web/wp-content/vendor/illuminate/view/FileViewFinder.php on line 137
[13-Jan-2023 21:13:20 UTC] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 2101248 bytes) in /var/www/html/web/wp/wp-includes/functions.php on line 5279
[13-Jan-2023 21:13:20 UTC] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 741376 bytes) in Unknown on line 0

So this appears to be some sort of View rendering issue.

Through some further debugging I came to point that perhaps with a URL ending in ?nf_preview_form=2 that it couldn’t properly determine the right view to pass to the Sage app. Sure enough it was passing the full path to the index.php file. I put in a check to force the view to a page and now things are rendering as expected.

Same here. Thanks for posting this.