dj-stripe / dj-stripe

dj-stripe automatically syncs your Stripe Data to your local database as pre-implemented Django Models allowing you to use the Django ORM, in your code, to work with the data making it easier and faster.
https://dj-stripe.dev
MIT License
1.56k stars 474 forks source link

djstripe.models.payment_methods.PaymentMethod.DoesNotExist: PaymentMethod matching query does not exist #2001

Open SurajPysquad opened 7 months ago

SurajPysquad commented 7 months ago

Describe the bug djstripe.models.payment_methods.PaymentMethod.DoesNotExist: PaymentMethod matching query does not exist. error_data.txt

*To Reproduce

Software versions

arnav13081994 commented 7 months ago

@SurajPysquad Deadlock issues are a know problem. But these are usually not an issue in livemode as the Stripe API retries a few times.

If you are able to consistently reproduce this then it is a problem. Please let us know.

SurajPysquad commented 5 months ago

@arnav13081994 on production server every day i have face this issues

File "/usr/local/lib/python3.10/site-packages/### djstripe/models/base.py", line 618, in _create_from_stripe_object instance = cls.stripeobjects.get(id=id)

File "/usr/local/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 637, in get raise self.model.DoesNotExist(

djstripe.models.billing.Subscription.DoesNotExist: Subscription matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params)

psycopg2.errors.DeadlockDetected: deadlock detected DETAIL: Process 20130 waits for ShareLock on transaction 1276574; blocked by process 20132. Process 20132 waits for ShareLock on transaction 1276570; blocked by process 20130. HINT: See server log for query details. CONTEXT: while inserting index tuple (6,3) in relation "### djstripe_subscription_id_key"

File "/usr/local/lib/python3.10/site-packages/djstripe/models/base.py", line 618, in _create_from_stripe_object instance = cls.stripeobjects.get(id=id)

File "/usr/local/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 637, in get raise self.model.DoesNotExist(

djstripe.models.core.PaymentIntent.DoesNotExist: PaymentIntent matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params)

psycopg2.errors.DeadlockDetected: deadlock detected DETAIL: Process 20132 waits for ShareLock on transaction 1276572; blocked by process 20131. Process 20131 waits for ShareLock on transaction 1276574; blocked by process 20132. HINT: See server log for query details. CONTEXT: while inserting index tuple (17,7) in relation "### djstripe_paymentintent_id_key"

File "/usr/local/lib/python3.10/site-packages/djstripe/models/base.py", line 618, in _create_from_stripe_object instance = cls.stripeobjects.get(id=id)

File "/usr/local/lib/python3.10/site-packages/django/db/models/manager.py", line 87, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/usr/local/lib/python3.10/site-packages/django/db/models/query.py", line 637, in get raise self.model.DoesNotExist(

djstripe.models.core.Charge.DoesNotExist: Charge matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params)

psycopg2.errors.DeadlockDetected: deadlock detected DETAIL: Process 10639 waits for ShareLock on transaction 1269645; blocked by process 10634. Process 10634 waits for ShareLock on transaction 1269655; blocked by process 10639. HINT: See server log for query details. CONTEXT: while inserting index tuple (41,2) in relation "### djstripe_charge_id_key"

arnav13081994 commented 5 months ago

@SurajPysquad Do the webhooks eventually succeed?