-
-
Notifications
You must be signed in to change notification settings - Fork 547
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
Static cache error – Undefined array key "scheme" #6764
Comments
Can confirm the bug. Same thing recently crashed a customer website. |
Can you both please provide your |
Sure: sites.php
static_caching.php
|
Related to #6496? |
Here’s mine: sites.php
static_caching.php
|
To both of you, I think this could be worked around by using an actual url in your site config. 'default' => [
'name' => config('app.name'),
'locale' => 'en_US',
'url' => '/',
], Change We'll look into the actual issue, but this could solve your error for now. |
Hi Jason I'd already tried the first example - I tried the env variable as well - but the error persists - this is on 3.3.37 locally. |
How are you serving your sites? Laravel Valet? I can't reproduce this. Would you be able to provide a github repo with this problem happening? |
Hej Jason, We actually rolled back to v3.3.35 and the error still persists. The site where the error occurs is served with k8s on a live server and it occurs only when we turn on static caching (half). With stataic caching turned off, the page works. The error we have is not the same as above, but it has the same pattern.
Sound like it is somehow related to #6781 and #6496 We couldn't reproduce it locally, either. |
Are you load balancing? What cache driver are you using? |
I'm also having this issue for one of our sites with the static cache strategy set to half and using the file cache driver. No load balancing or anything. Just a straight LAMP stack. |
The above was on my staging server. I've also reproduced it on a local dev copy
|
I believe I've found the source of the issue described above (at least on my project), and it comes down to the invalidation rules. I found if a URL in the invalidation rule does not start with a '/' then you get the above error when saving that collection / taxonomy term / etc. For example, the below rules triggers the error when saving:
And changing to this resolves the error:
Without diving deeper in to how Statamic static caching works under the hood, I assume it may be using the PHP function parse_url which is failing when the rules don't include the prefixed slash. I hope this helps! |
I can confirm that works with 3.3.43. I'd tried the trailing slash before but had overlooked putting one before a catchall Great spot Chris thanks. Jon |
Thank you @ChrisWorkhouse! That fixed it for me. Can we add some sort of check to prepend a slash if it's not present? In the getPathAndDomain method, it uses parse_url. Here's the current code:
I think adding something like the below code could be a preventative measure, but I'm not entirely familiar with everything going on in terms of the caching system. This effectively just checks the first character of the string of the path for a '/', and it prepends it to the string if it's not present. I'm not sure how elegant of a solution that is, but maybe it's worth looking into.
|
Still happening in Version: 3.3.58, slash already in place |
Nice work tracking down the issue @ChrisWorkhouse 💪🏻 ! |
Bug description
When saving a collection entry – specifically static entries in this case - I suddenly get a
server error
.How to reproduce
The entry is actually saved but the static cache is not cleared and an error is thrown.
This occurred once statamic cms is updated to 3.3.36. I also updated to 3.3.37 to see if there was a fix but the error remains.
I've gone back locally to 3.3.35, run
statamic update
, pushed the changes, and the error goes away.Log error listed below.
Logs
Environment
Installation
Fresh statamic/statamic site via CLI
Antlers Parser
runtime (new)
Additional details
No response
The text was updated successfully, but these errors were encountered: