Could also be caused by a third-party package that uses closures in their config. Check your packages.
Nov 5, 2019
6
Level 3
Cannot cache config, Your configuration files are not serializable
I have one Laravel project and when in production when I do:
php artisan config:cache
I get the following error:
Your configuration files are not serializable
I read that this is often down to callbacks being done in a configuration file, but I have double checked and there are no callbacks in my configuration files!
The full error is below. It makes reference to ConfigCacheCommand.php and Macroable.php, but these appear to be standard framework files.
Your configuration files are not serializable.
at xxx\vendor\laravel\framework\src\Illuminate\Foundation\Console\ConfigCacheCommand.php:71
67| require $configPath;
68| } catch (Throwable $e) {
69| $this->files->delete($configPath);
70|
> 71| throw new LogicException('Your configuration files are not serializable.', 0, $e);
72| }
73|
74| $this->info('Configuration cached successfully!');
75| }
Exception trace:
1 BadMethodCallException::("Method Illuminate\Support\Collection::__set_state does not exist.")
xxx\vendor\laravel\framework\src\Illuminate\Support\Traits\Macroable.php:77
2 Illuminate\Support\Collection::__callStatic("__set_state")
xxx\bootstrap\cache\config.php:832
Please use the argument -v to see more details.
Please or to participate in this conversation.