Failed Deployment: Class "Mockery" not found

Hi, I am deploying by building a Docker Image and pulling that after successful building on my server into a docker-compose setup. When my pipelines tries to pull that image it says:
$ docker-compose exec app php artisan storage:link && docker-compose exec app php artisan cache:clear

In SupportFileUploads.php line 17:

Class "Mockery" not found
$ docker-compose exec app php artisan storage:link && docker-compose exec app php artisan cache:clear

In SupportFileUploads.php line 17:

Class "Mockery" not found
7 Replies
alexanderkroneis
alexanderkroneisOPβ€’15mo ago
I am using this Dockerfile for multiple Laravel applications, e.g. Inertia + Vue, Statamic, APIs, ...
Dennis Koch
Dennis Kochβ€’15mo ago
Sounds like that trait is using Mockery which might be a dev dependency?
alexanderkroneis
alexanderkroneisOPβ€’15mo ago
I never heard of that trait, is that Livewire or Filament specific?
Dennis Koch
Dennis Kochβ€’15mo ago
Me neither. But it's probably one of those. How to tell with just a single line πŸ˜…
Hiz
Hizβ€’14mo ago
I just encountered this issue. This is a Livewire 3 specific issue. In the SupportFileUploads.php file, there is a function that checks if the environment your app is running in is a "testing" environment. If this is the case, it will make use of the Mockery class. In our case, we had an environment named "testing" and we just changed it to "test" in our .env, and it ran without any problems.
Remi Hindriks
Remi Hindriksβ€’8mo ago
Hi Hiz, could you explain a bit clearer what you did to fix this? We're running in to the same issue
Hiz
Hizβ€’8mo ago
Hi, We have 3 applications running on different servers. "Testing", "Acceptation" and "Production". On our testing server we have in our .env file the following:
APP_NAME=OurApp
APP_ENV=testing
APP_KEY=key
APP_DEBUG=false

# ... other .env stuff
APP_NAME=OurApp
APP_ENV=testing
APP_KEY=key
APP_DEBUG=false

# ... other .env stuff
And I simply renamed "testing" to "test" for APP_ENV
APP_ENV=test

# ... other .env stuff
APP_ENV=test

# ... other .env stuff
This resolved our issue.
Want results from more Discord servers?
Add your server