Fix Livewire Bref cache error on AWS
Tom Hatzer • April 16, 2021
laravel livewire bref awsYou have possibly seen this error message here:
The /var/task/bootstrap/cache directory must be present and writable. at /var/task/vendor/livewire/livewire/src/LivewireComponentsFinder.php:57
There's an easy fix for this. You just have to set the manifest_path in your config/livewire.php
file to /tmp/storage/livewire-components.php
and the error will be gone.
You already have additional information in the livewire config files docblock above the manifest_path
setting:
/*
|--------------------------------------------------------------------------
| Manifest File Path
|--------------------------------------------------------------------------
|
| This value sets the path to the Livewire manifest file.
| The default should work for most cases (which is
| "<app_root>/bootstrap/cache/livewire-components.php)", but for specific
| cases like when hosting on Laravel Vapor, it could be set to a different value.
|
| Example: for Laravel Vapor, it would be "/tmp/storage/bootstrap/cache/livewire-components.php".
|
*/
'manifest_path' => '/tmp/storage/livewire-components.php',
You can also set the value of the manifest_path
setting to something else inside your /tmp
folder. If you are using the filesystem for your cache files, the Laravel Vapor path should be fine.
If you are using DynamoDB to store your caches, the Laravel Vapor path might not exist and throw another error.