statamic / ssg

The official Statamic Static Site Generator
229 stars 23 forks source link

Generation fails - Nesting level too deep #144

Open mbootsman opened 10 months ago

mbootsman commented 10 months ago

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 commented 10 months ago

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

jasonvarga commented 10 months ago

Are you using the nocache tag?

mbootsman commented 10 months ago

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 :wink:

duncanmcclean commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

Ah ok good find.

A couple of workarounds: