ssg
ssg copied to clipboard
Generation fails - Nesting level too deep
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
After changing if ($aValue != $b[$aKey]) {
to if ($aValue !== $b[$aKey]) {
the SSG process finishes without problems. Is this a bug?
Are you using the nocache
tag?
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:
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?
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
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