I’v been having an issue with Laravel producing HTTP code 500 – "No application encryption key has been specified" -error randomly on my rest-routes. Of course I have set, and even reset the key with Artisan, so that shouldn’t be the issue.
This issue has always been present, ever since I started my project on Laravel 6. Quite quickly I was able to track issue to cache. Basically when cache was wiped with "php artisan cache:clear" REST-routes started to fail, about 5% of all the requests. When cache was generated again with "php artisan config:cache" the issue was resolved. For some reason it seems that .env -variables are not registered or read correctly when cache is wiped? Still, wasn’t an issue when developing and cache was configured.
I’v upgraded my project from Laravel 6 to 8 and now it seems that this issue has started to reproduce and I’m unable to find the reason.
My application has ~10-20 initial atomic REST-endpoint accesses for providing basic information for Vue SPA initialization. All of these requests happen asynchronously and every-now-and-then (maybe once per 10 page refreshes / reinitializations) one of those calls might fail.
Running things over latest XAMPP. Not using XDebug or anything else which might block calls. Wondering if anyone else has stumbled to this problem?