lmsqueezy / laravel

A package to easily integrate your Laravel application with Lemon Squeezy.
https://lemonsqueezy.com
MIT License
520 stars 51 forks source link

Error when Team Billable Model is used on Jetstream #108

Closed adiologydev closed 1 month ago

adiologydev commented 1 month ago

Lemon Squeezy for Laravel Version

1.6.2

Laravel Version

11.19.0

PHP Version

8.3.11

Description

When using Jetstream and the Billable feature on the Team model for multi-tenant subscriptions, you get the following error when subscribing if you already have an existing subscription.

[2024-10-08 18:34:19] local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into "lemon_squeezy_customers" ("billable_id", "billable_type", "lemon_squeezy_id", "updated_at", "created_at") values (10, App\Models\Team, 3879262, 2024-10-08 18:34:19, 2024-10-08 18:34:19)) {"exception":"[object] (Illuminate\Database\UniqueConstraintViolationException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into \"lemon_squeezy_customers\" (\"billable_id\", \"billable_type\", \"lemon_squeezy_id\", \"updated_at\", \"created_at\") values (10, App\Models\Team, 3879262, 2024-10-08 18:34:19, 2024-10-08 18:34:19)) at /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php:820)

It's because there's a unique constraint on lemon_squeezy_id on lemon_squeezy_customers table. I'm not sure about the best way to tackle this but I'd love to know your suggestions without changing a whole lot.

Steps To Reproduce

  1. In the file \App\Models\Team.php add use Billable to the model. Also add the following function to map team owner's ID to the model, otherwise it'll error.
    public function lemonSqueezyEmail(): ?string
    {
        return $this->owner->email;
    }
  2. Start your application then create a team and subscribe to any subscription using a subscription route i.e.
    Route::get('/billing/subscribe/{variantId}', function (Request $request, string $variantId) {
        return $request->user()->currentTeam->subscribe($variantId);
    })->name('billing.subscribe');
  3. Now go back to your application, create a new team and subscribe again.
  4. The webhook will now fail because of the issue I stated in the issue's description.
driesvints commented 1 month ago

Could you please paste the full stack trace so that I know which webhook failed and which DB query caused this? I have a hunch but want to be sure.

adiologydev commented 1 month ago

Sure, thank you for responding. I'm currently forwarding all the events to the webhook, but here are the details.

Failed Webhook: image

Trace:

[2024-10-09 11:11:29] local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into "lemon_squeezy_customers" ("billable_id", "billable_type", "lemon_squeezy_id", "updated_at", "created_at") values (10, App\Models\Team, 3879262, 2024-10-09 11:11:29, 2024-10-09 11:11:29)) {"exception":"[object] (Illuminate\\Database\\UniqueConstraintViolationException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into \"lemon_squeezy_customers\" (\"billable_id\", \"billable_type\", \"lemon_squeezy_id\", \"updated_at\", \"created_at\") values (10, App\\Models\\Team, 3879262, 2024-10-09 11:11:29, 2024-10-09 11:11:29)) at /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php:820)
[stacktrace]
#0 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(779): Illuminate\\Database\\Connection->runQueryCallback('insert into \"le...', Array, Object(Closure))
#1 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(560): Illuminate\\Database\\Connection->run('insert into \"le...', Array, Object(Closure))
#2 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(524): Illuminate\\Database\\Connection->statement('insert into \"le...', Array)
#3 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\\Database\\Connection->insert('insert into \"le...', Array)
#4 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3796): Illuminate\\Database\\Query\\Processors\\Processor->processInsertGetId(Object(Illuminate\\Database\\Query\\Builder), 'insert into \"le...', Array, 'id')
#5 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(2038): Illuminate\\Database\\Query\\Builder->insertGetId(Array, 'id')
#6 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1358): Illuminate\\Database\\Eloquent\\Builder->__call('insertGetId', Array)
#7 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1323): Illuminate\\Database\\Eloquent\\Model->insertAndSetId(Object(Illuminate\\Database\\Eloquent\\Builder), Array)
#8 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1162): Illuminate\\Database\\Eloquent\\Model->performInsert(Object(Illuminate\\Database\\Eloquent\\Builder))
#9 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1079): Illuminate\\Database\\Eloquent\\Model->save()
#10 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Support/helpers.php(380): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}(Object(LemonSqueezy\\Laravel\\Customer))
#11 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1078): tap(Object(LemonSqueezy\\Laravel\\Customer), Object(Closure))
#12 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(601): Illuminate\\Database\\Eloquent\\Builder->create(Array)
#13 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1782): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}()
#14 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(601): Illuminate\\Database\\Eloquent\\Builder->withSavepointIfNeeded(Object(Closure))
#15 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(588): Illuminate\\Database\\Eloquent\\Builder->createOrFirst(Array, Array)
#16 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(23): Illuminate\\Database\\Eloquent\\Builder->firstOrCreate(Array, Array)
#17 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2367): Illuminate\\Database\\Eloquent\\Model->forwardCallTo(Object(Illuminate\\Database\\Eloquent\\Builder), 'firstOrCreate', Array)
#18 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2379): Illuminate\\Database\\Eloquent\\Model->__call('firstOrCreate', Array)
#19 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(301): Illuminate\\Database\\Eloquent\\Model::__callStatic('firstOrCreate', Array)
#20 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(289): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->findOrCreateCustomer('10', 'App\\\\Models\\\\Team', '3879262')
#21 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(77): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->resolveBillable(Array)
#22 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(62): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->handleOrderCreated(Array)
#23 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->__invoke(Object(Illuminate\\Http\\Request))
#24 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('__invoke', Array)
#25 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Route.php(262): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController), '__invoke')
#26 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Route.php(208): Illuminate\\Routing\\Route->runController()
#27 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(808): Illuminate\\Routing\\Route->run()
#28 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Middleware/VerifyWebhookSignature.php(25): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): LemonSqueezy\\Laravel\\Http\\Middleware\\VerifyWebhookSignature->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(807): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#33 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(786): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#34 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#35 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(739): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#36 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(201): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#37 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#38 /home/aditya/workspace/[redacted]/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#40 /home/aditya/workspace/[redacted]/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#41 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#42 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#49 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#51 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(58): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#56 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/InvokeDeferredCallbacks.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#57 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\InvokeDeferredCallbacks->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#60 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#61 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1188): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#62 /home/aditya/workspace/[redacted]/public/index.php(17): Illuminate\\Foundation\\Application->handleRequest(Object(Illuminate\\Http\\Request))
#63 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(23): require_once('/home/aditya/wo...')
#64 {main}

[2024-10-09 11:11:35] local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into "lemon_squeezy_customers" ("billable_id", "billable_type", "lemon_squeezy_id", "updated_at", "created_at") values (10, App\Models\Team, 3879262, 2024-10-09 11:11:35, 2024-10-09 11:11:35)) {"exception":"[object] (Illuminate\\Database\\UniqueConstraintViolationException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into \"lemon_squeezy_customers\" (\"billable_id\", \"billable_type\", \"lemon_squeezy_id\", \"updated_at\", \"created_at\") values (10, App\\Models\\Team, 3879262, 2024-10-09 11:11:35, 2024-10-09 11:11:35)) at /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php:820)
[stacktrace]
#0 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(779): Illuminate\\Database\\Connection->runQueryCallback('insert into \"le...', Array, Object(Closure))
#1 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(560): Illuminate\\Database\\Connection->run('insert into \"le...', Array, Object(Closure))
#2 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(524): Illuminate\\Database\\Connection->statement('insert into \"le...', Array)
#3 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\\Database\\Connection->insert('insert into \"le...', Array)
#4 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3796): Illuminate\\Database\\Query\\Processors\\Processor->processInsertGetId(Object(Illuminate\\Database\\Query\\Builder), 'insert into \"le...', Array, 'id')
#5 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(2038): Illuminate\\Database\\Query\\Builder->insertGetId(Array, 'id')
#6 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1358): Illuminate\\Database\\Eloquent\\Builder->__call('insertGetId', Array)
#7 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1323): Illuminate\\Database\\Eloquent\\Model->insertAndSetId(Object(Illuminate\\Database\\Eloquent\\Builder), Array)
#8 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1162): Illuminate\\Database\\Eloquent\\Model->performInsert(Object(Illuminate\\Database\\Eloquent\\Builder))
#9 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1079): Illuminate\\Database\\Eloquent\\Model->save()
#10 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Support/helpers.php(380): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}(Object(LemonSqueezy\\Laravel\\Customer))
#11 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1078): tap(Object(LemonSqueezy\\Laravel\\Customer), Object(Closure))
#12 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(601): Illuminate\\Database\\Eloquent\\Builder->create(Array)
#13 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1782): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}()
#14 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(601): Illuminate\\Database\\Eloquent\\Builder->withSavepointIfNeeded(Object(Closure))
#15 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(588): Illuminate\\Database\\Eloquent\\Builder->createOrFirst(Array, Array)
#16 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(23): Illuminate\\Database\\Eloquent\\Builder->firstOrCreate(Array, Array)
#17 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2367): Illuminate\\Database\\Eloquent\\Model->forwardCallTo(Object(Illuminate\\Database\\Eloquent\\Builder), 'firstOrCreate', Array)
#18 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2379): Illuminate\\Database\\Eloquent\\Model->__call('firstOrCreate', Array)
#19 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(301): Illuminate\\Database\\Eloquent\\Model::__callStatic('firstOrCreate', Array)
#20 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(289): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->findOrCreateCustomer('10', 'App\\\\Models\\\\Team', '3879262')
#21 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(77): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->resolveBillable(Array)
#22 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(62): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->handleOrderCreated(Array)
#23 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->__invoke(Object(Illuminate\\Http\\Request))
#24 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('__invoke', Array)
#25 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Route.php(262): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController), '__invoke')
#26 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Route.php(208): Illuminate\\Routing\\Route->runController()
#27 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(808): Illuminate\\Routing\\Route->run()
#28 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Middleware/VerifyWebhookSignature.php(25): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): LemonSqueezy\\Laravel\\Http\\Middleware\\VerifyWebhookSignature->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(807): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#33 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(786): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#34 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#35 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(739): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#36 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(201): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#37 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#38 /home/aditya/workspace/[redacted]/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#40 /home/aditya/workspace/[redacted]/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#41 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#42 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#49 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#51 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(58): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#56 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/InvokeDeferredCallbacks.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#57 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\InvokeDeferredCallbacks->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#60 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#61 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1188): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#62 /home/aditya/workspace/[redacted]/public/index.php(17): Illuminate\\Foundation\\Application->handleRequest(Object(Illuminate\\Http\\Request))
#63 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(23): require_once('/home/aditya/wo...')
#64 {main}

[2024-10-09 11:11:37] local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into "lemon_squeezy_customers" ("billable_id", "billable_type", "lemon_squeezy_id", "updated_at", "created_at") values (10, App\Models\Team, 3879262, 2024-10-09 11:11:37, 2024-10-09 11:11:37)) {"exception":"[object] (Illuminate\\Database\\UniqueConstraintViolationException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into \"lemon_squeezy_customers\" (\"billable_id\", \"billable_type\", \"lemon_squeezy_id\", \"updated_at\", \"created_at\") values (10, App\\Models\\Team, 3879262, 2024-10-09 11:11:37, 2024-10-09 11:11:37)) at /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php:820)
[stacktrace]
#0 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(779): Illuminate\\Database\\Connection->runQueryCallback('insert into \"le...', Array, Object(Closure))
#1 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(560): Illuminate\\Database\\Connection->run('insert into \"le...', Array, Object(Closure))
#2 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(524): Illuminate\\Database\\Connection->statement('insert into \"le...', Array)
#3 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\\Database\\Connection->insert('insert into \"le...', Array)
#4 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3796): Illuminate\\Database\\Query\\Processors\\Processor->processInsertGetId(Object(Illuminate\\Database\\Query\\Builder), 'insert into \"le...', Array, 'id')
#5 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(2038): Illuminate\\Database\\Query\\Builder->insertGetId(Array, 'id')
#6 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1358): Illuminate\\Database\\Eloquent\\Builder->__call('insertGetId', Array)
#7 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1323): Illuminate\\Database\\Eloquent\\Model->insertAndSetId(Object(Illuminate\\Database\\Eloquent\\Builder), Array)
#8 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1162): Illuminate\\Database\\Eloquent\\Model->performInsert(Object(Illuminate\\Database\\Eloquent\\Builder))
#9 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1079): Illuminate\\Database\\Eloquent\\Model->save()
#10 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Support/helpers.php(380): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}(Object(LemonSqueezy\\Laravel\\Customer))
#11 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1078): tap(Object(LemonSqueezy\\Laravel\\Customer), Object(Closure))
#12 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(601): Illuminate\\Database\\Eloquent\\Builder->create(Array)
#13 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1782): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}()
#14 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(601): Illuminate\\Database\\Eloquent\\Builder->withSavepointIfNeeded(Object(Closure))
#15 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(588): Illuminate\\Database\\Eloquent\\Builder->createOrFirst(Array, Array)
#16 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(23): Illuminate\\Database\\Eloquent\\Builder->firstOrCreate(Array, Array)
#17 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2367): Illuminate\\Database\\Eloquent\\Model->forwardCallTo(Object(Illuminate\\Database\\Eloquent\\Builder), 'firstOrCreate', Array)
#18 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2379): Illuminate\\Database\\Eloquent\\Model->__call('firstOrCreate', Array)
#19 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(301): Illuminate\\Database\\Eloquent\\Model::__callStatic('firstOrCreate', Array)
#20 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(289): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->findOrCreateCustomer('10', 'App\\\\Models\\\\Team', '3879262')
#21 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(132): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->resolveBillable(Array)
#22 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(62): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->handleSubscriptionCreated(Array)
#23 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->__invoke(Object(Illuminate\\Http\\Request))
#24 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('__invoke', Array)
#25 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Route.php(262): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController), '__invoke')
#26 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Route.php(208): Illuminate\\Routing\\Route->runController()
#27 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(808): Illuminate\\Routing\\Route->run()
#28 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Middleware/VerifyWebhookSignature.php(25): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): LemonSqueezy\\Laravel\\Http\\Middleware\\VerifyWebhookSignature->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(807): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#33 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(786): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#34 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#35 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(739): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#36 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(201): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#37 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#38 /home/aditya/workspace/[redacted]/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#40 /home/aditya/workspace/[redacted]/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#41 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#42 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#49 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#51 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(58): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#56 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/InvokeDeferredCallbacks.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#57 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\InvokeDeferredCallbacks->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#60 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#61 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1188): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#62 /home/aditya/workspace/[redacted]/public/index.php(17): Illuminate\\Foundation\\Application->handleRequest(Object(Illuminate\\Http\\Request))
#63 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(23): require_once('/home/aditya/wo...')
#64 {main}

[2024-10-09 11:12:05] local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into "lemon_squeezy_customers" ("billable_id", "billable_type", "lemon_squeezy_id", "updated_at", "created_at") values (10, App\Models\Team, 3879262, 2024-10-09 11:12:05, 2024-10-09 11:12:05)) {"exception":"[object] (Illuminate\\Database\\UniqueConstraintViolationException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into \"lemon_squeezy_customers\" (\"billable_id\", \"billable_type\", \"lemon_squeezy_id\", \"updated_at\", \"created_at\") values (10, App\\Models\\Team, 3879262, 2024-10-09 11:12:05, 2024-10-09 11:12:05)) at /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php:820)
[stacktrace]
#0 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(779): Illuminate\\Database\\Connection->runQueryCallback('insert into \"le...', Array, Object(Closure))
#1 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(560): Illuminate\\Database\\Connection->run('insert into \"le...', Array, Object(Closure))
#2 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(524): Illuminate\\Database\\Connection->statement('insert into \"le...', Array)
#3 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\\Database\\Connection->insert('insert into \"le...', Array)
#4 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3796): Illuminate\\Database\\Query\\Processors\\Processor->processInsertGetId(Object(Illuminate\\Database\\Query\\Builder), 'insert into \"le...', Array, 'id')
#5 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(2038): Illuminate\\Database\\Query\\Builder->insertGetId(Array, 'id')
#6 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1358): Illuminate\\Database\\Eloquent\\Builder->__call('insertGetId', Array)
#7 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1323): Illuminate\\Database\\Eloquent\\Model->insertAndSetId(Object(Illuminate\\Database\\Eloquent\\Builder), Array)
#8 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1162): Illuminate\\Database\\Eloquent\\Model->performInsert(Object(Illuminate\\Database\\Eloquent\\Builder))
#9 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1079): Illuminate\\Database\\Eloquent\\Model->save()
#10 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Support/helpers.php(380): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}(Object(LemonSqueezy\\Laravel\\Customer))
#11 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1078): tap(Object(LemonSqueezy\\Laravel\\Customer), Object(Closure))
#12 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(601): Illuminate\\Database\\Eloquent\\Builder->create(Array)
#13 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1782): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}()
#14 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(601): Illuminate\\Database\\Eloquent\\Builder->withSavepointIfNeeded(Object(Closure))
#15 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(588): Illuminate\\Database\\Eloquent\\Builder->createOrFirst(Array, Array)
#16 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(23): Illuminate\\Database\\Eloquent\\Builder->firstOrCreate(Array, Array)
#17 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2367): Illuminate\\Database\\Eloquent\\Model->forwardCallTo(Object(Illuminate\\Database\\Eloquent\\Builder), 'firstOrCreate', Array)
#18 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2379): Illuminate\\Database\\Eloquent\\Model->__call('firstOrCreate', Array)
#19 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(301): Illuminate\\Database\\Eloquent\\Model::__callStatic('firstOrCreate', Array)
#20 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(289): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->findOrCreateCustomer('10', 'App\\\\Models\\\\Team', '3879262')
#21 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(132): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->resolveBillable(Array)
#22 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(62): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->handleSubscriptionCreated(Array)
#23 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->__invoke(Object(Illuminate\\Http\\Request))
#24 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('__invoke', Array)
#25 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Route.php(262): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController), '__invoke')
#26 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Route.php(208): Illuminate\\Routing\\Route->runController()
#27 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(808): Illuminate\\Routing\\Route->run()
#28 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Middleware/VerifyWebhookSignature.php(25): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): LemonSqueezy\\Laravel\\Http\\Middleware\\VerifyWebhookSignature->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(807): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#33 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(786): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#34 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#35 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(739): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#36 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(201): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#37 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#38 /home/aditya/workspace/[redacted]/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#40 /home/aditya/workspace/[redacted]/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#41 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#42 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#49 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#51 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(58): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#56 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/InvokeDeferredCallbacks.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#57 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\InvokeDeferredCallbacks->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#60 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#61 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1188): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#62 /home/aditya/workspace/[redacted]/public/index.php(17): Illuminate\\Foundation\\Application->handleRequest(Object(Illuminate\\Http\\Request))
#63 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(23): require_once('/home/aditya/wo...')
#64 {main}

[2024-10-09 11:12:05] local.ERROR: SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into "lemon_squeezy_customers" ("billable_id", "billable_type", "lemon_squeezy_id", "updated_at", "created_at") values (10, App\Models\Team, 3879262, 2024-10-09 11:12:05, 2024-10-09 11:12:05)) {"exception":"[object] (Illuminate\\Database\\UniqueConstraintViolationException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: lemon_squeezy_customers.lemon_squeezy_id (Connection: sqlite, SQL: insert into \"lemon_squeezy_customers\" (\"billable_id\", \"billable_type\", \"lemon_squeezy_id\", \"updated_at\", \"created_at\") values (10, App\\Models\\Team, 3879262, 2024-10-09 11:12:05, 2024-10-09 11:12:05)) at /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php:820)
[stacktrace]
#0 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(779): Illuminate\\Database\\Connection->runQueryCallback('insert into \"le...', Array, Object(Closure))
#1 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(560): Illuminate\\Database\\Connection->run('insert into \"le...', Array, Object(Closure))
#2 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Connection.php(524): Illuminate\\Database\\Connection->statement('insert into \"le...', Array)
#3 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\\Database\\Connection->insert('insert into \"le...', Array)
#4 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3796): Illuminate\\Database\\Query\\Processors\\Processor->processInsertGetId(Object(Illuminate\\Database\\Query\\Builder), 'insert into \"le...', Array, 'id')
#5 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(2038): Illuminate\\Database\\Query\\Builder->insertGetId(Array, 'id')
#6 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1358): Illuminate\\Database\\Eloquent\\Builder->__call('insertGetId', Array)
#7 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1323): Illuminate\\Database\\Eloquent\\Model->insertAndSetId(Object(Illuminate\\Database\\Eloquent\\Builder), Array)
#8 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1162): Illuminate\\Database\\Eloquent\\Model->performInsert(Object(Illuminate\\Database\\Eloquent\\Builder))
#9 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1079): Illuminate\\Database\\Eloquent\\Model->save()
#10 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Support/helpers.php(380): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}(Object(LemonSqueezy\\Laravel\\Customer))
#11 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1078): tap(Object(LemonSqueezy\\Laravel\\Customer), Object(Closure))
#12 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(601): Illuminate\\Database\\Eloquent\\Builder->create(Array)
#13 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1782): Illuminate\\Database\\Eloquent\\Builder->Illuminate\\Database\\Eloquent\\{closure}()
#14 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(601): Illuminate\\Database\\Eloquent\\Builder->withSavepointIfNeeded(Object(Closure))
#15 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(588): Illuminate\\Database\\Eloquent\\Builder->createOrFirst(Array, Array)
#16 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(23): Illuminate\\Database\\Eloquent\\Builder->firstOrCreate(Array, Array)
#17 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2367): Illuminate\\Database\\Eloquent\\Model->forwardCallTo(Object(Illuminate\\Database\\Eloquent\\Builder), 'firstOrCreate', Array)
#18 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2379): Illuminate\\Database\\Eloquent\\Model->__call('firstOrCreate', Array)
#19 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(301): Illuminate\\Database\\Eloquent\\Model::__callStatic('firstOrCreate', Array)
#20 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(289): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->findOrCreateCustomer('10', 'App\\\\Models\\\\Team', '3879262')
#21 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(77): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->resolveBillable(Array)
#22 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Controllers/WebhookController.php(62): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->handleOrderCreated(Array)
#23 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController->__invoke(Object(Illuminate\\Http\\Request))
#24 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(43): Illuminate\\Routing\\Controller->callAction('__invoke', Array)
#25 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Route.php(262): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(LemonSqueezy\\Laravel\\Http\\Controllers\\WebhookController), '__invoke')
#26 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Route.php(208): Illuminate\\Routing\\Route->runController()
#27 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(808): Illuminate\\Routing\\Route->run()
#28 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#29 /home/aditya/workspace/[redacted]/vendor/lemonsqueezy/laravel/src/Http/Middleware/VerifyWebhookSignature.php(25): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): LemonSqueezy\\Laravel\\Http\\Middleware\\VerifyWebhookSignature->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#31 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#32 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(807): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#33 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(786): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#34 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#35 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Routing/Router.php(739): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#36 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(201): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#37 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#38 /home/aditya/workspace/[redacted]/vendor/livewire/livewire/src/Features/SupportDisablingBackButtonCache/DisableBackButtonCacheMiddleware.php(19): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Livewire\\Features\\SupportDisablingBackButtonCache\\DisableBackButtonCacheMiddleware->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#40 /home/aditya/workspace/[redacted]/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(66): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#41 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Barryvdh\\Debugbar\\Middleware\\InjectDebugbar->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#42 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#43 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#48 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#49 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#51 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#52 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#53 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#54 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(58): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#55 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#56 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/InvokeDeferredCallbacks.php(22): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#57 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\\Foundation\\Http\\Middleware\\InvokeDeferredCallbacks->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#58 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#59 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#60 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(145): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#61 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1188): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#62 /home/aditya/workspace/[redacted]/public/index.php(17): Illuminate\\Foundation\\Application->handleRequest(Object(Illuminate\\Http\\Request))
#63 /home/aditya/workspace/[redacted]/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(23): require_once('/home/aditya/wo...')
#64 {main}
driesvints commented 1 month ago

I think I know what's going on here. You're trying to do a purchase for a customer on an email that's already used by another customer in your Lemon Squeezy store. This is unfortunately a limitation by Lemon Squeezy. An email address is always connected to a single customer. Therefor you cannot associate multiple billables with the same Lemon Squeezy customer.

There's nothing I can do here I'm afraid. Ideally Lemon Squeezy would take the same approach as Stripe and would allow new customers to be created even if there was already a customer in the same store with the same email address. But the way I understand it is that this is a difficult undertaking for them to do.

adiologydev commented 1 month ago

Thanks, I understand, so in this case, the only way to deal with this would be to make the customer id non-unique, I will try this approach, hopefully it doesn't conflict with the functionality of this package.

driesvints commented 1 month ago

I don't think that's possible with how the package functions. I can't vouch for that sorry.