Redirects stopped working with 3.9.4
I noticed that with Version 3.9.4 redirects don't work anymore, because the new source_md5 field is not working correctly. I couldn't really find out why, but source_md5 is set correctly in save@RedirectRepository, but if I run a query on the Stache store, it is set to null for all redirects and thus does not find any item.
Downgrading to 3.9.3 fixes the issue.
Thanks for looking into that!
I think we ran into the same problem and got a lot of "table errors has no column named url_md5" errors after updating to the latest version of this addon.
Sorry about this, I'll try to take a look today (just moved house so the past weeks were a bit hectic)
No worries @riasvdv, thanks for your work! 🙏
This specific bug should be fixed in 3.9.5, let me know if it works!
Hey the Bug is still there. I have to downgrade also to the 3.9.3
Just updating from 3.9.4 which wasn't working to the latest version 3.10.3 and composer throws error
Error
Call to a member function source_md5() on null
at vendor/rias/statamic-redirect/src/UpdateScripts/IncreaseUrlSizeOnRedirects.php:21
17▕ {
18▕ $redirectConnection = config('statamic.redirect.redirect_connection');
19▕
20▕ if ($redirectConnection === 'stache') {
➜ 21▕ return ! Redirect::all()->first()->source_md5();
22▕ }
23▕
24▕ if ($redirectConnection === 'default') {
25▕ $redirectConnection = config('database.default');
+1 vendor frames
2 [internal]:0
Statamic\UpdateScripts\Manager::{closure:Statamic\UpdateScripts\Manager::runUpdatableScripts():83}(Object(Rias\StatamicRedirect\UpdateScripts\IncreaseUrlSizeOnRedirects))
+20 vendor frames
23 artisan:13
Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))
Script @php artisan statamic:install --ansi handling the post-autoload-dump event returned with error code 1
@atomicjam Looks like I forgot the edge case of having no redirects yet, let me know if the latest release fixes this for you https://github.com/riasvdv/statamic-redirect/releases/tag/3.10.4
still throws for me on 3.10.4
Running update script [Rias\StatamicRedirect\UpdateScripts\IncreaseUrlSizeOnRedirects]
Error
Call to a member function source_md5() on null
at vendor/rias/statamic-redirect/src/UpdateScripts/IncreaseUrlSizeOnRedirects.php:41
37▕ {
38▕ $redirectConnection = config('statamic.redirect.redirect_connection');
39▕
40▕ if ($redirectConnection === 'stache') {
➜ 41▕ if (Redirect::all()->first()->source_md5()) {
42▕ return;
43▕ }
44▕
45▕ Redirect::all()->each(function (\Rias\StatamicRedirect\Data\Redirect $redirect) {
+20 vendor frames
21 artisan:13
Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))
Script @php artisan statamic:install --ansi handling the post-autoload-dump event returned with error code 1
Ah, that's a different line, try 3.10.5, sorry about that
Perfect 3.10.5 worked
@riasvdv Not sure if this is related to this issue, one of our clients also noticed that their redirects suddenly stopped working.
After updating to 3.10.5 the redirects still didn't work for us.
Then I found out that it's most likely because IncreaseUrlSizeOnRedirects never ran on our production server, since we use composer install instead of composer update in our deploy script.
Is there any chance this is the issue?
You can try to run php artisan statamic:install which should run the update scripts as well
You can try to run
php artisan statamic:installwhich should run the update scripts as well
Just tried this as well, but it doesn't seem to run the update script. Only composer update seems to work.
In our Case was, that the migrations were created and running multiple times after updating. We had to delete all migrations except the last one with the source_md5.