jacksleight / statamic-memberbox

This Statamic addon adds a few member related extras on top of Statamic’s existing user features.
https://statamic.com/addons/jacksleight/memberbox
Other
2 stars 3 forks source link

Call to a member function handle() on null #2

Closed torian257x closed 3 years ago

torian257x commented 3 years ago

Leaving this here, hopefully saves someone time

Error in statamic backend when listing users: image

local.ERROR: Call to a member function handle() on null {"userId":55,"exception":"[object] (Error(code: 0): Call to a member function handle() on null at /home/myproject/vendor/laravel/framewor
k/src/Illuminate/Collections/HigherOrderCollectionProxy.php:60)
[stacktrace]
#0 /home/myproject/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(473): Illuminate\\Support\\HigherOrderCollectionProxy->Illuminate\\Support\\{closure}()
#1 /home/myproject/vendor/laravel/framework/src/Illuminate/Collections/HigherOrderCollectionProxy.php(61): Illuminate\\Support\\Collection->keyBy()
#2 /home/myproject/vendor/statamic/cms/src/Auth/Eloquent/User.php(173): Illuminate\\Support\\HigherOrderCollectionProxy->__call()
#3 /home/myproject/vendor/statamic/cms/src/Auth/Eloquent/User.php(164): Statamic\\Auth\\Eloquent\\User->getGroups()
#4 /home/myproject/vendor/statamic/cms/src/Auth/Eloquent/User.php(229): Statamic\\Auth\\Eloquent\\User->groups()
#5 /home/myproject/vendor/statamic/cms/src/Auth/Eloquent/User.php(242): Statamic\\Auth\\Eloquent\\User->permissions()
#6 /home/myproject/vendor/statamic/cms/src/Auth/User.php(80): Statamic\\Auth\\Eloquent\\User->hasPermission()
#7 /home/myproject/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(23): Statamic\\Auth\\User->isSuper()
#8 /home/myproject/vendor/laravel/framework/src/Illuminate/Http/Resources/DelegatesToResource.php(152): Illuminate\\Http\\Resources\\Json\\JsonResource->forwardCallTo()
#9 /home/myproject/vendor/statamic/cms/src/Http/Resources/CP/Users/ListedUser.php(34): Illuminate\\Http\\Resources\\Json\\JsonResource->__call()
#10 /home/myproject/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php(95): Statamic\\Http\\Resources\\CP\\Users\\ListedUser->toArray()
#11 /home/myproject/vendor/laravel/framework/src/Illuminate/Http/Resources/Json/JsonResource.php(232): Illuminate\\Http\\Resources\\Json\\JsonResource->resolve()
#12 /home/myproject/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(863): Illuminate\\Http\\Resources\\Json\\JsonResource->jsonSerialize()
#13 [internal function]: Illuminate\\Support\\Collection->Illuminate\\Support\\Traits\\{closure}()
#14 /home/myproject/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(871): array_map()
#15 [internal function]: Illuminate\\Support\\Collection->jsonSerialize()

reason for me was: I tried out this project with a DB driver on my existing project. I created new branch in my project, feature/members or whatever

I assigned, like mentioned in the docs, a group to the members.

I then decided I won't use the project for my use case (unless to get inspired by the statamic knowledge as an example for things)

So next day I checkout my main branch again.

Now I have weird errors, go to my colleagues "waddup?" they don't have the problem.

Problem was: members addon created an entry in group_user table. When listing users in statamic backend, this caused a hiccup, found the entry, and something was missing somehow I guess for that entry

torian257x commented 3 years ago

Solution: remove the members addon group that was added into table group_user.