Customer matching query does not exist.
See original GitHub issueDescribe the bug When the customer pays using the payment link, the first payment works fine, but the second one or thirds gives error
A customer matching query does not exist.
Traceback
Traceback (most recent call last):
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/base.py", line 598, in _create_from_stripe_object
instance = cls.stripe_objects.get(id=id_)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/query.py", line 496, in get
raise self.model.DoesNotExist(
djstripe.models.core.Customer.DoesNotExist: Customer matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/backends/oracle/base.py", line 552, in execute
return self.cursor.execute(query, self._param_generator(params))
cx_Oracle.IntegrityError: ORA-00001: unique constraint (MINERVA.DJSTRIPE__SUBSCRIBE_E83292EA_U) violated
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/base.py", line 724, in _get_or_create_from_stripe_object
cls._create_from_stripe_object(
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/base.py", line 613, in _create_from_stripe_object
instance.save()
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/base.py", line 806, in save
self.save_base(
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/base.py", line 857, in save_base
updated = self._save_table(
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/base.py", line 1000, in _save_table
results = self._do_insert(
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/base.py", line 1041, in _do_insert
return manager._insert(
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/query.py", line 1434, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1621, in execute_sql
cursor.execute(sql, params)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 103, in execute
return super().execute(sql, params)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/backends/oracle/base.py", line 552, in execute
return self.cursor.execute(query, self._param_generator(params))
django.db.utils.IntegrityError: ORA-00001: unique constraint (MINERVA.DJSTRIPE__SUBSCRIBE_E83292EA_U) violated
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/webhooks.py", line 225, in from_request
obj.process(save=False, api_key=api_key)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/webhooks.py", line 324, in process
self.event = Event.process(self.json_body, api_key=api_key)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/core.py", line 1580, in process
ret.invoke_webhook_handlers()
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/core.py", line 1592, in invoke_webhook_handlers
webhooks.call_handlers(event=self)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/webhooks.py", line 98, in call_handlers
handler_func(event=event)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/event_handlers.py", line 315, in other_object_webhook_handler
_handle_crud_like_event(target_cls=target_cls, event=event)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/event_handlers.py", line 400, in _handle_crud_like_event
kwargs["customer"] = event.customer
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/core.py", line 1622, in customer
return Customer._get_or_retrieve(
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/base.py", line 1035, in _get_or_retrieve
instance = cls.sync_from_stripe_data(data, api_key=kwargs.get("api_key"))
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/base.py", line 990, in sync_from_stripe_data
instance, created = cls._get_or_create_from_stripe_object(
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/djstripe/models/base.py", line 740, in _get_or_create_from_stripe_object
return cls.stripe_objects.get(id=id_), False
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/Users/ahmedsafadi/Desktop/web/oracleTest/venv/lib/python3.8/site-packages/django/db/models/query.py", line 496, in get
raise self.model.DoesNotExist(
djstripe.models.core.Customer.DoesNotExist: Customer matching query does not exist.
To Reproduce simply you just need to pay using the payment link, note that the user is registered on the website before going to do the payment.
https://buy.stripe.com/test_5kA2aHfV96K7bIcdQS
Software versions
- Dj-Stripe version: 2.7.0a7
- Python version: 3.10
- Django version: 4.0.4
- Stripe API version: Latest
- Database type and version: Orcale 21.0
Issue Analytics
- State:
- Created a year ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Django error - matching query does not exist - Stack Overflow
EDIT: I have manually queried the database using the same information retrieved from the server error email I received. I was able to...
Read more >UserPreference matching query does not exist. - Django Forum
Django throws a DoesNotExist exception when it can't find a match for your .get() query, in this case UserPreference.objects.get(user=request.
Read more >Matching query does not exist. : r/django - Reddit
I'm trying to create a discount card (balance) that each time someone buys a seat, the total sum will be added to it...
Read more >matching query does not exist Error in Django - YouTube
Django : matching query does not exist Error in Django [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] Django ...
Read more >Django: SocialApp matching query does not exist - YouTube
Django : Django: SocialApp matching query does not exist [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] Django ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@arnav13081994 thank you.
I have seen this error when local and remote database do not match, after some reset/restore of local djstripe database. What happened in my case was that
Customer
Customer
records the ID of theUser
when it is synced to stripe.comUser
gets anotherid
.Customer
is used, it tries to locate theUser
with the saved id, and an error occurs when the user with thatid
does not exist or points to anotherCustomer
.