Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

SteamDiesel's avatar

Deployment issue: CloudinaryLabs Class not found

Hello, I have an error when deploying to my server using forge, I'm stumped. I have been unable to find similar issues with other packages so far. When I deploy to forge, it fails and says this:

Updating 5e54d2d..7d17d7c
Fast-forward
 app/Http/Controllers/ImageController.php | 4 ++--
 config/app.php                           | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
Restarting FPM...

In ProviderRepository.php line 208:
                                                                               
  Class "CloudinaryLabs\CloudinaryLaravel\CloudinaryServiceProvider" not found   

This is what my config/app.php looks like.


    'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
     			// ...

        /*
         * Package Service Providers...
         */
        Stevebauman\Location\LocationServiceProvider::class,
        CloudinaryLabs\CloudinaryLaravel\CloudinaryServiceProvider::class, 

        /*
         * Application Service Providers...
         */
			  // ...

    ],

When I comment out the cloudinary package from this list, I get a different error:

In Application.php line 749: // see the different file name
                                                                               
  Class "CloudinaryLabs\CloudinaryLaravel\CloudinaryServiceProvider" not found 

it seems like this is "vendor\laravel\framework\src\Illuminate\Foundation\Application.php" and that line refers to this function:

    /**
     * Resolve a service provider instance from the class name.
     *
     * @param  string  $provider
     * @return \Illuminate\Support\ServiceProvider
     */
    public function resolveProvider($provider)
    {
        return new $provider($this);
    }

I'm not using the package anywhere, but I am referencing a single method from the package:

namespace App\Http\Controllers;

use App\Models\Image;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class ImageController extends Controller
{
    public function store(Request $request)
    {
        // validate the incoming file
        if (!$request->hasFile('image')) {
            return response()->json(['error' => 'There is no image present.'], 400);
        }
        $request->validate([
            'image' => 'required|file|image',
        ]);
        $user = Auth::user();
        // save the file in storage
        $path = 'user/' . $user->id . '/images';
        $result = $request->file('image')->storeOnCloudinary($path); // right here

        if (!$result) {
            return response()->json(['error' => 'The file could not be saved.'], 500);
        }

        // create image model

        $uploaded_file = $request->file('image');
        $image = Image::create([
            'user_id' => $user->id,
            'extension' => $uploaded_file->extension(),
            'size' => $uploaded_file->getSize(),
            'path' => $result->getSecurePath(),
            'public_id' => $result->getPublicId()
        ]);

        // return the image model back to the frontend
        return $image;
    }
}

There are no issues with this package on my local sail dev environment. So my guess is that maybe it's having trouble with the case-sensitive (CloudinaryLabs = cloudinary-labs) names of the package. But I would have no idea how to resolve that.

I have followed the docs for installing for laravel 9, here's the link to the package and docs: https://github.com/cloudinary-labs/cloudinary-laravel

That package method has only been used in the image controller, so I can't think of where else it could be hiding...

Could someone please point me in the direction of places to start looking?

0 likes
2 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Try ssh into your server and delete the vendor directory and then run composer install

1 like

Please or to participate in this conversation.