Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation fails - Nesting level too deep #144

Open
mbootsman opened this issue Aug 17, 2023 · 6 comments
Open

Generation fails - Nesting level too deep #144

mbootsman opened this issue Aug 17, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@mbootsman
Copy link

mbootsman commented Aug 17, 2023

When generating the static site, I get this error.
I have no idea where to look to solve this, so I'm hoping some of you do :)

Here's the output of the command php please ssg:generate. Also tried with spatie/fork and 4 workers, which gives the same error.

You may be able to speed up site generation significantly by installing spatie/fork and using multiple workers (requires PHP 8+).
[✔] Gathered content to be generated
Generating /page-not-found
PHP Fatal error:  Nesting level too deep - recursive dependency? in /home/marcel/Sites/marcelbootsman/vendor/statamic/cms/src/StaticCaching/NoCache/Region.php on line 55

   Symfony\Component\ErrorHandler\Error\FatalError 

  Nesting level too deep - recursive dependency?

  at vendor/statamic/cms/src/StaticCaching/NoCache/Region.php:55
     51▕                     if (! empty($aRecursiveDiff)) {
     52▕                         $data[$aKey] = $aRecursiveDiff;
     53▕                     }
     54▕                 } else {
  ➜  55▕                     if ($aValue != $b[$aKey]) {
     56▕                         $data[$aKey] = $aValue;
     57▕                     }
     58▕                 }
     59▕             } else {


   Whoops\Exception\ErrorException 

  Nesting level too deep - recursive dependency?

  at vendor/statamic/cms/src/StaticCaching/NoCache/Region.php:55
     51▕                     if (! empty($aRecursiveDiff)) {
     52▕                         $data[$aKey] = $aRecursiveDiff;
     53▕                     }
     54▕                 } else {
  ➜  55▕                     if ($aValue != $b[$aKey]) {
     56▕                         $data[$aKey] = $aValue;
     57▕                     }
     58▕                 }
     59▕             } else {

      +1 vendor frames 

  2   [internal]:0
      Whoops\Run::handleShutdown()

Static site generation failed.

Statamic version: 4.18.0
Statamic SSG version: 2.1

@mbootsman
Copy link
Author

After changing if ($aValue != $b[$aKey]) { to if ($aValue !== $b[$aKey]) { the SSG process finishes without problems. Is this a bug?

@jasonvarga
Copy link
Member

Are you using the nocache tag?

@mbootsman
Copy link
Author

Are you using the nocache tag?

If I would know where to look to determine if I'm using that, I can give you an answer 😉

@duncanmcclean
Copy link
Member

Are you using the nocache tag?

If I would know where to look to determine if I'm using that, I can give you an answer 😉

In your templates are you doing {{ nocache }} anywhere?

@mbootsman
Copy link
Author

mbootsman commented Aug 24, 2023

Are you using the nocache tag?

If I would know where to look to determine if I'm using that, I can give you an answer 😉

In your templates are you doing {{ nocache }} anywhere?

I checked the code in my project. No {{ nocache }} tag used anywhere.
CORRECTION. {{ nocache }} is used in the Peak Tools addon. For the toolbar. Here's a link to the repo: https://github.com/studio1902/statamic-peak-tools/blob/3638df88d5ec575114391a7f2a01ad67118eebc6/resources/views/components/_toolbar.antlers.html#L8

@jasonvarga
Copy link
Member

Ah ok good find.

A couple of workarounds:

  • Run the ssg:generate in production mode. (php please ssg:generate --env=production) as it looks like that template will avoid doing anything in production.
  • Make a copy of that view and remove the nocache tags. Or just empty it. Place it in resources/views/vendor/statamic-peak-tools/components/_toolbar.antlers.html

@duncanmcclean duncanmcclean added the bug Something isn't working label Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants