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

Laravel 11 compatibility? "Target [Laravel\Fortify\Contracts\CreatesNewUsers] is not instantiable." #1451

Closed
maxleistner opened this issue Mar 14, 2024 · 9 comments

Comments

@maxleistner
Copy link

Jetstream Version

5

Jetstream Stack

Livewire

Laravel Version

11.0.5

PHP Version

8.3

Database Driver & Version

mysql sail

Description

After going through all installation steps i get. the following error trying to register:

Target [Laravel\Fortify\Contracts\CreatesNewUsers] is not instantiable.

Steps To Reproduce

Install laravel 11 with sail
Install JetStream Livewire + Tams

https://flareapp.io/share/NPGZ9nNm#stack

@maxleistner
Copy link
Author

I found the error:

App\Providers\FortifyServiceProvider::class, was missing from bootstrap/providers.php. After the following code changes it works:

<?php

return [
    App\Providers\AppServiceProvider::class,
    App\Providers\JetstreamServiceProvider::class,
    App\Providers\FortifyServiceProvider::class,
];

@driesvints
Copy link
Member

@maxleistner I tried this and it just adds the service provider for me. If you have this issue still please provide a very detailed list of steps to reproduce.

@sotten
Copy link
Contributor

sotten commented Mar 14, 2024

@driesvints

I can also confirm this.
Commands to reproduce this under Ubuntu 22.04 LTS:

curl -s https://laravel.build/testapp2 | bash
cd testapp2 && ./vendor/bin/sail up -d && ./vendor/bin/sail composer require laravel/jetstream && ./vendor/bin/sail artisan jetstream:install livewire && ./vendor/bin/sail artisan test

should produce this output:

   PASS  Tests\Unit\ExampleTest
  ✓ that true is true

   WARN  Tests\Feature\ApiTokenPermissionsTest
  - api token permissions can be updated → API support is not enabled.                                                                                                                                      1.95s  

   PASS  Tests\Feature\AuthenticationTest
  ✓ login screen can be rendered                                                                                                                                                                            0.08s  
  ✓ users can authenticate using the login screen                                                                                                                                                           0.07s  
  ✓ users can not authenticate with invalid password                                                                                                                                                        0.03s  

   PASS  Tests\Feature\BrowserSessionsTest
  ✓ other browser sessions can be logged out                                                                                                                                                                0.06s  

   WARN  Tests\Feature\CreateApiTokenTest
  - api tokens can be created → API support is not enabled.                                                                                                                                                 0.01s  

   PASS  Tests\Feature\DeleteAccountTest
  ✓ user accounts can be deleted                                                                                                                                                                            0.05s  
  ✓ correct password must be provided before account can be deleted                                                                                                                                         0.04s  

   WARN  Tests\Feature\DeleteApiTokenTest
  - api tokens can be deleted → API support is not enabled.                                                                                                                                                 0.01s  

   WARN  Tests\Feature\EmailVerificationTest
  - email verification screen can be rendered → Email verification not enabled.                                                                                                                             0.01s  
  - email can be verified → Email verification not enabled.                                                                                                                                                 0.01s  
  - email can not verified with invalid hash → Email verification not enabled.                                                                                                                              0.01s  

   PASS  Tests\Feature\ExampleTest
  ✓ the application returns a successful response                                                                                                                                                           0.02s  

   PASS  Tests\Feature\PasswordConfirmationTest
  ✓ confirm password screen can be rendered                                                                                                                                                                 0.04s  
  ✓ password can be confirmed                                                                                                                                                                               0.03s  
  ✓ password is not confirmed with invalid password                                                                                                                                                         0.23s  

   PASS  Tests\Feature\PasswordResetTest
  ✓ reset password link screen can be rendered                                                                                                                                                              0.06s  
  ✓ reset password link can be requested                                                                                                                                                                    0.05s  
  ✓ reset password screen can be rendered                                                                                                                                                                   0.04s  
  ✓ password can be reset with valid token                                                                                                                                                                  0.08s  

   FAIL  Tests\Feature\ProfileInformationTest
  ✓ current profile information is available                                                                                                                                                                0.05s  
  ⨯ profile information can be updated                                                                                                                                                                      0.03s  

   FAIL  Tests\Feature\RegistrationTest
  ✓ registration screen can be rendered                                                                                                                                                                     0.03s  
  - registration screen cannot be rendered if support is disabled → Registration support is enabled.                                                                                                        0.01s  
  ⨯ new users can register                                                                                                                                                                                  0.04s  

   PASS  Tests\Feature\TwoFactorAuthenticationSettingsTest
  ✓ two factor authentication can be enabled                                                                                                                                                                0.13s  
  ✓ recovery codes can be regenerated                                                                                                                                                                       0.24s  
  ✓ two factor authentication can be disabled                                                                                                                                                               0.11s  

   FAIL  Tests\Feature\UpdatePasswordTest
  ⨯ password can be updated                                                                                                                                                                                 0.05s  
  ⨯ current password must be correct                                                                                                                                                                        0.04s  
  ⨯ new passwords must match                                                                                                                                                                                0.03s  
  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\ProfileInformationTest > profile information can be updated                                                                                                  BindingResolutionException   
  Target [Laravel\Fortify\Contracts\UpdatesUserProfileInformation] is not instantiable.

  at vendor/laravel/framework/src/Illuminate/Container/Container.php:1118
    1114▕         } else {
    1115▕             $message = "Target [$concrete] is not instantiable.";
    1116▕         }
    1117▕ 
  ➜ 1118▕         throw new BindingResolutionException($message);
    1119▕     }
    1120▕ 
    1121▕     /**
    1122▕      * Throw an exception for an unresolvable primitive.

      +40 vendor frames 
  41  tests/Feature/ProfileInformationTest.php:31

  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\RegistrationTest > new users can register                                                                                                                                                 
  The user is not authenticated
Failed asserting that false is true.

  at tests/Feature/RegistrationTest.php:50
     46▕             'password_confirmation' => 'password',
     47▕             'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature(),
     48▕         ]);
     49▕ 
  ➜  50▕         $this->assertAuthenticated();
     51▕         $response->assertRedirect(route('dashboard', absolute: false));
     52▕     }
     53▕ }
     54▕ 

  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\UpdatePasswordTest > password can be updated                                                                                                                 BindingResolutionException   
  Target [Laravel\Fortify\Contracts\UpdatesUserPasswords] is not instantiable.

  at vendor/laravel/framework/src/Illuminate/Container/Container.php:1118
    1114▕         } else {
    1115▕             $message = "Target [$concrete] is not instantiable.";
    1116▕         }
    1117▕ 
  ➜ 1118▕         throw new BindingResolutionException($message);
    1119▕     }
    1120▕ 
    1121▕     /**
    1122▕      * Throw an exception for an unresolvable primitive.

      +40 vendor frames 
  41  tests/Feature/UpdatePasswordTest.php:26

  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\UpdatePasswordTest > current password must be correct                                                                                                        BindingResolutionException   
  Target [Laravel\Fortify\Contracts\UpdatesUserPasswords] is not instantiable.

  at vendor/laravel/framework/src/Illuminate/Container/Container.php:1118
    1114▕         } else {
    1115▕             $message = "Target [$concrete] is not instantiable.";
    1116▕         }
    1117▕ 
  ➜ 1118▕         throw new BindingResolutionException($message);
    1119▕     }
    1120▕ 
    1121▕     /**
    1122▕      * Throw an exception for an unresolvable primitive.

      +40 vendor frames 
  41  tests/Feature/UpdatePasswordTest.php:41

  ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────  
   FAILED  Tests\Feature\UpdatePasswordTest > new passwords must match                                                                                                                BindingResolutionException   
  Target [Laravel\Fortify\Contracts\UpdatesUserPasswords] is not instantiable.

  at vendor/laravel/framework/src/Illuminate/Container/Container.php:1118
    1114▕         } else {
    1115▕             $message = "Target [$concrete] is not instantiable.";
    1116▕         }
    1117▕ 
  ➜ 1118▕         throw new BindingResolutionException($message);
    1119▕     }
    1120▕ 
    1121▕     /**
    1122▕      * Throw an exception for an unresolvable primitive.

      +40 vendor frames 
  41  tests/Feature/UpdatePasswordTest.php:57


  Tests:    5 failed, 7 skipped, 20 passed (33 assertions)
  Duration: 3.79s

@ronald2wing
Copy link

ronald2wing commented Mar 14, 2024

@maxleistner This should not be set to completed until merged into the main branch.

@driesvints
Copy link
Member

@maxleistner @sotten do you both have opcache enabled by any chance?

@maxleistner maxleistner reopened this Mar 19, 2024
@maxleistner
Copy link
Author

@maxleistner @sotten do you both have opcache enabled by any chance?

I am "just" using the composer commands to install sail and did not change anything on the docker image or compose.

@driesvints
Copy link
Member

@maxleistner can you check if opcache is enabled?

sail php -i | grep opcache.enable          

@maxleistner
Copy link
Author

maxleistner commented Mar 19, 2024

@maxleistner can you check if opcache is enabled?

sail php -i | grep opcache.enable          

https://app.warp.dev/block/kDq4xPfw8BCm5jPYrbl1vy

opcache.enable => On => On
opcache.enable_cli => On => On
opcache.enable_file_override => Off => Off

@driesvints
Copy link
Member

Thanks @maxleistner. Gonna close this one in favour of #1454 which is the same thing and Jess is already investigating there.

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

4 participants