Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

in_array(): Argument #2 ($haystack) must be of type array, null given {"exception":"[object] (TypeError(code: 0): in_array(): Argument #2 ($haystack) must be of type array, null given at /spatie/laravel-multitenancy/src/Actions/MakeQueueTenantAwareAction.php:79) #512

Closed
brada1703 opened this issue Jan 11, 2024 · 1 comment

Comments

@brada1703
Copy link

I have been getting thousands of this error since yesterday. However, I can't seem to figure out where it is coming from.

Within MakeQueueTenantAwareAction.php on line 79, there is:

if (in_array($reflection->name, config('multitenancy.tenant_aware_jobs'))) {

So, according to the error, the config('multitenancy.tenant_aware_jobs') should be null.

However, when I go to vendor/spatie/laravel-multitenancy/config/multitenancy.php I can see that the tenant_aware_jobs is an empty array:

    'tenant_aware_jobs' => [
        // ...
    ],

Looking at my failed_jobs table, this seems to be coming from App\\Notifications\\ActionCompleted, which I haven't touched in months. Furthermore, within the payload, I can see that the tenantIdis present. So, that shouldn't be the issue.

I have tried to fix it by restarting the queue. Also, running php artisan queue:monitor default gives me Size / Status of [0] OK.

Has anone seen this issue before?

Thanks!

Full error:

[2024-01-11 00:10:40] production.ERROR: in_array(): Argument #2 ($haystack) must be of type array, null given {"exception":"[object] (TypeError(code: 0): in_array(): Argument #2 ($haystack) must be of type array, null given at /spatie/laravel-multitenancy/src/Actions/MakeQueueTenantAwareAction.php:79)
[stacktrace]
#0 /spatie/laravel-multitenancy/src/Actions/MakeQueueTenantAwareAction.php(79): in_array()
#1 /spatie/laravel-multitenancy/src/Actions/MakeQueueTenantAwareAction.php(31): Spatie\\Multitenancy\\Actions\\MakeQueueTenantAwareAction->isTenantAware()
#2 /laravel/framework/src/Illuminate/Queue/Queue.php(285): Spatie\\Multitenancy\\Actions\\MakeQueueTenantAwareAction->Spatie\\Multitenancy\\Actions\\{closure}()
#3 /laravel/framework/src/Illuminate/Queue/Queue.php(140): Illuminate\\Queue\\Queue->withCreatePayloadHooks()
#4 /laravel/framework/src/Illuminate/Queue/Queue.php(127): Illuminate\\Queue\\Queue->createObjectPayload()
#5 /laravel/framework/src/Illuminate/Queue/RedisQueue.php(212): Illuminate\\Queue\\Queue->createPayloadArray()
#6 /laravel/framework/src/Illuminate/Queue/Queue.php(105): Illuminate\\Queue\\RedisQueue->createPayloadArray()
#7 /laravel/framework/src/Illuminate/Queue/RedisQueue.php(136): Illuminate\\Queue\\Queue->createPayload()
#8 /laravel/framework/src/Illuminate/Queue/Queue.php(57): Illuminate\\Queue\\RedisQueue->push()
#9 /laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php(183): Illuminate\\Queue\\Queue->pushOn()
#10 /laravel/framework/src/Illuminate/Events/Dispatcher.php(320): Illuminate\\Broadcasting\\BroadcastManager->queue()
#11 /laravel/framework/src/Illuminate/Events/Dispatcher.php(243): Illuminate\\Events\\Dispatcher->broadcastEvent()
#12 /laravel/framework/src/Illuminate/Notifications/Channels/BroadcastChannel.php(51): Illuminate\\Events\\Dispatcher->dispatch()
#13 /laravel/framework/src/Illuminate/Notifications/NotificationSender.php(148): Illuminate\\Notifications\\Channels\\BroadcastChannel->send()
#14 /laravel/framework/src/Illuminate/Notifications/NotificationSender.php(106): Illuminate\\Notifications\\NotificationSender->sendToNotifiable()
#15 /laravel/framework/src/Illuminate/Support/Traits/Localizable.php(19): Illuminate\\Notifications\\NotificationSender->Illuminate\\Notifications\\{closure}()
#16 /laravel/framework/src/Illuminate/Notifications/NotificationSender.php(101): Illuminate\\Notifications\\NotificationSender->withLocale()
#17 /laravel/framework/src/Illuminate/Notifications/ChannelManager.php(54): Illuminate\\Notifications\\NotificationSender->sendNow()
#18 /laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php(112): Illuminate\\Notifications\\ChannelManager->sendNow()
#19 /laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Notifications\\SendQueuedNotifications->handle()
#20 /laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#21 /laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#22 /laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#23 /laravel/framework/src/Illuminate/Container/Container.php(661): Illuminate\\Container\\BoundMethod::call()
#24 /laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#25 /laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#26 /laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#27 /laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#28 /laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\\Bus\\Dispatcher->dispatchNow()
#29 /laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#30 /laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#31 /laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\\Pipeline\\Pipeline->then()
#32 /laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#33 /laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call()
#34 /laravel/framework/src/Illuminate/Queue/Worker.php(425): Illuminate\\Queue\\Jobs\\Job->fire()
#35 /laravel/framework/src/Illuminate/Queue/Worker.php(375): Illuminate\\Queue\\Worker->process()
#36 /laravel/framework/src/Illuminate/Queue/Worker.php(173): Illuminate\\Queue\\Worker->runJob()
#37 /laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(147): Illuminate\\Queue\\Worker->daemon()
#38 /laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(130): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#39 /laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#40 /laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#41 /laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#42 /laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#43 /laravel/framework/src/Illuminate/Container/Container.php(661): Illuminate\\Container\\BoundMethod::call()
#44 /laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\\Container\\Container->call()
#45 /symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute()
#46 /laravel/framework/src/Illuminate/Console/Command.php(152): Symfony\\Component\\Console\\Command\\Command->run()
#47 /symfony/console/Application.php(1063): Illuminate\\Console\\Command->run()
#48 /symfony/console/Application.php(320): Symfony\\Component\\Console\\Application->doRunCommand()
#49 /symfony/console/Application.php(174): Symfony\\Component\\Console\\Application->doRun()
#50 /laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\\Component\\Console\\Application->run()
#51 /laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(155): Illuminate\\Console\\Application->run()
#52 /artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#53 {main}
"} 

@MattWiseParking
Copy link

have you ran the configuration file into your config folder? you should have a config/multitenancy.php file

you will need to run:

php artisan vendor:publish --provider="Spatie\Multitenancy\MultitenancyServiceProvider" --tag="multitenancy-config"

after running the above, refresh the config using php artisan config:cache or php artisan tenants:artisan "config:cache"

@spatie spatie locked and limited conversation to collaborators Jan 12, 2024
@masterix21 masterix21 converted this issue into discussion #513 Jan 12, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants