Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable broadcasting after upgrade Laravel from 10.x to 11.x #51157

Closed
armingdev opened this issue Apr 21, 2024 · 1 comment
Closed

Enable broadcasting after upgrade Laravel from 10.x to 11.x #51157

armingdev opened this issue Apr 21, 2024 · 1 comment

Comments

@armingdev
Copy link

armingdev commented Apr 21, 2024

Laravel Version

11.4.0

PHP Version

8.3.4

Database Driver & Version

PostgreSQL 15.6 (Sail)

Description

After upgrading Laravel from 10.x to 11.x with Laravel Shift, I'm trying to re-enabling broadcasting with the command: sail artisan install:broadcasting . Here is the command result:

sail artisan install:broadcasting

   INFO  Published 'broadcasting' configuration file.


   Illuminate\Contracts\Filesystem\FileNotFoundException

  File does not exist at path /var/www/html/config/app.php.

  at vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:58
     54if ($this->isFile($path)) {
     55return $lock ? $this->sharedGet($path) : file_get_contents($path);
     56▕         }
     57▕
  ➜  58▕         throw new FileNotFoundException("File does not exist at path {$path}.");
     59▕     }
     6061▕     /**
     62▕      * Get the contents of a file as decoded JSON.

      +15 vendor frames

  16  artisan:13
      Illuminate\Foundation\Application::handleCommand()

I don't have config/app.php since I'm on Laravel 11 and only bootstrap/app.php with this content (also I already have routes/channels.php):

      <?php

use App\Providers\AppServiceProvider;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

return Application::configure(basePath: dirname(__DIR__))
    ->withProviders()
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        api: __DIR__.'/../routes/api.php',
        commands: __DIR__.'/../routes/console.php',
        channels: __DIR__.'/../routes/channels.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        $middleware->redirectGuestsTo(fn () => route('login'));
        $middleware->redirectUsersTo(AppServiceProvider::HOME);

        $middleware->throttleApi();
        $middleware->api(\App\Http\Middleware\ActivityByUser::class);

        $middleware->alias([
            'optimizeImages' => \Spatie\LaravelImageOptimizer\Middlewares\OptimizeImages::class,
        ]);
    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })->create();

Logs:

[2024-04-21 17:02:42] local.ERROR: File does not exist at path /var/www/html/config/app.php. {"exception":"[object] (Illuminate\\Contracts\\Filesystem\\FileNotFoundException(code: 0): File does not exist at path /var/www/html/config/app.php. at /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:58)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php(118): Illuminate\\Filesystem\\Filesystem->get()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php(54): Illuminate\\Foundation\\Console\\BroadcastingInstallCommand->enableBroadcastServiceProvider()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Foundation\\Console\\BroadcastingInstallCommand->handle()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(212): Illuminate\\Container\\Container->call()
#8 /var/www/html/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\\Component\\Console\\Command\\Command->run()
#10 /var/www/html/vendor/symfony/console/Application.php(1049): Illuminate\\Console\\Command->run()
#11 /var/www/html/vendor/symfony/console/Application.php(318): Symfony\\Component\\Console\\Application->doRunCommand()
#12 /var/www/html/vendor/symfony/console/Application.php(169): Symfony\\Component\\Console\\Application->doRun()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(196): Symfony\\Component\\Console\\Application->run()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1183): Illuminate\\Foundation\\Console\\Kernel->handle()
#15 /var/www/html/artisan(13): Illuminate\\Foundation\\Application->handleCommand()
#16 {main}
"} 

Steps To Reproduce

In upgraded Laravel 10 to 11 application, following https://laravel.com/docs/11.x/broadcasting#installation guide, run :

php artisan install:broadcasting

Result in error as described above.

@driesvints
Copy link
Member

I don't have config/app.php since I'm on Laravel 11

We don't officially support removing this file sorry. Please re-add the default config files from https://github.com/laravel/laravel/tree/11.x/config and try again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants