2

I'm using symfony 4.4 via docker and installed FOS user bundle some time ago. Everything was working fine but recently while trying to login, i keep getting the error

Call to a member function findOneBy() on null. The full trace is this

{
    "meta": {
        "code": 0,
        "message": "Call to a member function findOneBy() on null",
        "file": "/var/www/symfony/vendor/friendsofsymfony/user-bundle/Doctrine/UserManager.php",
        "line": 76,
        "trace": [
            {
                "file": "/var/www/symfony/vendor/friendsofsymfony/user-bundle/Model/UserManager.php",
                "line": 58,
                "function": "findUserBy"
            },
            {
                "file": "/var/www/symfony/vendor/friendsofsymfony/user-bundle/Security/UserProvider.php",
                "line": 93,
                "function": "findUserByUsername"
            },
            {
                "file": "/var/www/symfony/vendor/friendsofsymfony/user-bundle/Security/UserProvider.php",
                "line": 43,
                "function": "findUser"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/security-core/User/ChainUserProvider.php",
                "line": 56,
                "function": "loadUserByUsername"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/security-core/Authentication/Provider/DaoAuthenticationProvider.php",
                "line": 85,
                "function": "loadUserByUsername"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/security-core/Authentication/Provider/UserAuthenticationProvider.php",
                "line": 65,
                "function": "retrieveUser"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/security-core/Authentication/AuthenticationProviderManager.php",
                "line": 85,
                "function": "authenticate"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/security-http/Firewall/UsernamePasswordJsonAuthenticationListener.php",
                "line": 137,
                "function": "authenticate"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/security-bundle/Debug/WrappedLazyListener.php",
                "line": 49,
                "function": "authenticate"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/security-http/Firewall/AbstractListener.php",
                "line": 27,
                "function": "authenticate"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php",
                "line": 62,
                "function": "__invoke"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/security-http/Firewall.php",
                "line": 98,
                "function": "callListeners"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/event-dispatcher/Debug/WrappedListener.php",
                "line": 126,
                "function": "onKernelRequest"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/event-dispatcher/EventDispatcher.php",
                "line": 264,
                "function": "__invoke"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/event-dispatcher/EventDispatcher.php",
                "line": 239,
                "function": "doDispatch"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/event-dispatcher/EventDispatcher.php",
                "line": 73,
                "function": "callListeners"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php",
                "line": 168,
                "function": "dispatch"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/http-kernel/HttpKernel.php",
                "line": 134,
                "function": "dispatch"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/http-kernel/HttpKernel.php",
                "line": 80,
                "function": "handleRaw"
            },
            {
                "file": "/var/www/symfony/vendor/symfony/http-kernel/Kernel.php",
                "line": 201,
                "function": "handle"
            },
            {
                "file": "/var/www/symfony/public/index.php",
                "line": 25,
                "function": "handle"
            }
        ]
    },
    "links": {
        "self": "/api/auth/login"
    },
    "errors": [
        {
            "status": "500",
            "code": "INTERNAL_SERVER_ERROR",
            "title": "Internal Server Error"
        }
    ]
}

The register endpoint works pretty good at url api/auth/register and registers the new user.

Any ideas?

1
  • 1
    Welcome to StackOverflow. Did you launch any command to update your vendor libraries? Did you verify that the recipes have been upgraded? Jul 7, 2020 at 5:46

1 Answer 1

1

Finally i could solve the issue by permanently deleting the vendor folder and using composer install to install all packages again.

Composer update didn't help at all.

I'm still not sure what was the issue but the solution for this problem was that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.