Hi, I am using full static caching for a few websites. Some have a large contentbase. Most of the pages have about two or three regions that use the @nocache tag (Yes I am using Blade in this project because half of the project is a custom MyAccount app in Laravel 11).
I see that after a while, when it tries to get the content for it's nocache regions (when doing a POST call on /!/nocache), it has a payload with:
The regions are empty, which means that my dynamic content (also one is the logged-in state) isn't returned/replaced, there is just the csrf token.
Maybe I am doing something wrong in the setup, are you seeing something obvious about this.. please let us know!
Also, bugsnag notified me that Statamic threw a RegionNotFound exception:
Exception: Statamic\StaticCaching\NoCache\RegionNotFound
Message: Region [3ba7447dd9d6a975732b2ba24b01425f621307622953b2bbf8b337b4bc5b669bfde44c11] not found.
More in the log
How to reproduce
Wish I could tell you.. :-\
Logs
[2024-10-23 17:30:01] production.ERROR: Region [3ba7447dd9d6a975732b2ba24b01425f621307622953b2bbf8b337b4bc5b669bfde44c11] not found. {"exception":"[object] (Statamic\\StaticCaching\\NoCache\\RegionNotFound(code: 0): Region [3ba7447dd9d6a975732b2ba24b01425f621307622953b2bbf8b337b4bc5b669bfde44c11] not found. at /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/NoCache/Session.php:57)
[stacktrace]
#0 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/Replacers/NoCacheReplacer.php(67): Statamic\\StaticCaching\\NoCache\\Session->region()
#1 [internal function]: Statamic\\StaticCaching\\Replacers\\NoCacheReplacer->Statamic\\StaticCaching\\Replacers\\{closure}()
#2 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/Replacers/NoCacheReplacer.php(62): preg_replace_callback()
#3 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/Replacers/NoCacheReplacer.php(54): Statamic\\StaticCaching\\Replacers\\NoCacheReplacer->performReplacement()
#4 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/Replacers/NoCacheReplacer.php(48): Statamic\\StaticCaching\\Replacers\\NoCacheReplacer->replace()
#5 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/Replacers/NoCacheReplacer.php(26): Statamic\\StaticCaching\\Replacers\\NoCacheReplacer->replaceInResponse()
#6 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/Middleware/Cache.php(138): Statamic\\StaticCaching\\Replacers\\NoCacheReplacer->prepareResponseToCache()
#7 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(257): Statamic\\StaticCaching\\Middleware\\Cache->Statamic\\StaticCaching\\Middleware\\{closure}()
#8 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/Middleware/Cache.php(138): Illuminate\\Support\\Collection->each()
#9 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/Middleware/Cache.php(83): Statamic\\StaticCaching\\Middleware\\Cache->makeReplacementsAndCacheResponse()
#10 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/Middleware/Cache.php(59): Statamic\\StaticCaching\\Middleware\\Cache->handleRequest()
#11 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Cache/Lock.php(131): Statamic\\StaticCaching\\Middleware\\Cache->Statamic\\StaticCaching\\Middleware\\{closure}()
#12 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/StaticCaching/Middleware/Cache.php(59): Illuminate\\Cache\\Lock->block()
#13 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\StaticCaching\\Middleware\\Cache->handle()
#14 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/app/Http/Middleware/MijnPasCachePrevention.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#15 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\\Http\\Middleware\\MijnPasCachePrevention->handle()
#16 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(51): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#17 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#18 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(88): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#19 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle()
#20 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#21 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle()
#22 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#23 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest()
#24 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Session\\Middleware\\StartSession->handle()
#25 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#26 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle()
#27 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(75): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#28 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle()
#29 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#30 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Routing/Router.php(807): Illuminate\\Pipeline\\Pipeline->then()
#31 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Routing/Router.php(786): Illuminate\\Routing\\Router->runRouteWithinStack()
#32 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\\Routing\\Router->runRoute()
#33 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Routing/Router.php(739): Illuminate\\Routing\\Router->dispatchToRoute()
#34 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(201): Illuminate\\Routing\\Router->dispatch()
#35 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#36 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/Http/Middleware/StopImpersonating.php(12): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#37 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\StopImpersonating->handle()
#38 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/Http/Middleware/DisableFloc.php(17): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#39 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\DisableFloc->handle()
#40 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/Http/Middleware/CheckMultisite.php(15): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#41 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CheckMultisite->handle()
#42 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/Http/Middleware/CheckComposerJsonScripts.php(14): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#43 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\CheckComposerJsonScripts->handle()
#44 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/statamic/cms/src/Http/Middleware/PoweredByHeader.php(18): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#45 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Statamic\\Http\\Middleware\\PoweredByHeader->handle()
#46 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#47 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle()
#48 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(59): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#49 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle()
#50 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#51 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#52 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#53 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#54 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#55 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#56 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#57 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\ValidatePostSize->handle()
#58 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#59 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#60 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#61 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle()
#62 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(58): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#63 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#64 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/InvokeDeferredCallbacks.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#65 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\InvokeDeferredCallbacks->handle()
#66 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#67 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Pipeline\\Pipeline->then()
#68 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#69 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1188): Illuminate\\Foundation\\Http\\Kernel->handle()
#70 /home/mypas/domains/mydomainpas.nl/releases/aa25ad6b20646936f54cb50ece453b19cfae3ce2/public/index.php(17): Illuminate\\Foundation\\Application->handleRequest()
#71 {main}
"}
[2024-10-23 17:34:42] production.DEBUG: Static cache loaded [https://www.mydomainpas.nl/hoe-werkt-het] If you are seeing this, your server rewrite rules have not been set up correctly.
[2024-10-23 17:35:23] production.DEBUG: Static cache loaded [https://www.mydomainpas.nl/tegoed-besteden] If you are seeing this, your server rewrite rules have not been set up correctly.
[2024-10-23 17:37:39] production.DEBUG: Static cache loaded [https://www.mydomainpas.nl/aanvragen-of-verlengen] If you are seeing this, your server rewrite rules have not been set up correctly.
Bug description
Hi, I am using full static caching for a few websites. Some have a large contentbase. Most of the pages have about two or three regions that use the
@nocache
tag (Yes I am using Blade in this project because half of the project is a custom MyAccount app in Laravel 11).I see that after a while, when it tries to get the content for it's nocache regions (when doing a POST call on
/!/nocache
), it has a payload with:In turn it returns with just this:
The regions are empty, which means that my dynamic content (also one is the logged-in state) isn't returned/replaced, there is just the csrf token.
Maybe I am doing something wrong in the setup, are you seeing something obvious about this.. please let us know!
Also, bugsnag notified me that Statamic threw a
RegionNotFound
exception:Exception:
Statamic\StaticCaching\NoCache\RegionNotFound
Message:Region [3ba7447dd9d6a975732b2ba24b01425f621307622953b2bbf8b337b4bc5b669bfde44c11] not found.
More in the log
How to reproduce
Wish I could tell you.. :-\
Logs
Environment
Installation
Starter Kit using via CLI
Additional details
Statamic\StaticCaching\Middleware\Cache
middleware on our Laravel route to ensure the replacers should work