From df193231f61ab819ba6d1636787f01c9d498d445 Mon Sep 17 00:00:00 2001 From: Luke Walsh Date: Mon, 9 Jun 2025 14:36:48 +0100 Subject: [PATCH] Only set the queue/connection from the config if they are set because returning null means it overrides any on job connections and quees meaninf it alway defaults. --- src/Traits/WebhookController.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Traits/WebhookController.php b/src/Traits/WebhookController.php index 0ec401cd..3fff8c3a 100644 --- a/src/Traits/WebhookController.php +++ b/src/Traits/WebhookController.php @@ -32,11 +32,20 @@ public function handle(string $type, Request $request): ResponseResponse $jobClass = $config[$type]['class']; } - $jobClass::dispatch( + $dispatch = $jobClass::dispatch( $request->header('x-shopify-shop-domain'), $jobData - )->onConnection(Util::getShopifyConfig('job_connections')['webhooks']) - ->onQueue(Util::getShopifyConfig('job_queues')['webhooks']); + ); + + $connection = Util::getShopifyConfig('job_connections')['webhooks'] ?? null; + if ($connection) { + $dispatch->onConnection($connection); + } + + $queue = Util::getShopifyConfig('job_queues')['webhooks'] ?? null; + if ($queue) { + $dispatch->onQueue($queue); + } return Response::make('', ResponseResponse::HTTP_CREATED); }