-1

I have a django model where I have a OneToOneField to djstripe's Customer. When I run makemigrations a migration is created with the following dependency:

dependencies = [ ('djstripe', '0011_alter_invoice_charge_alter_invoice_customer_and_more'), ('users', '0007_rename_username), ]

Everything seems to be okay locally, but then when I deploy my code it fails with the following error:

django.db.migrations.exceptions.NodeNotFoundError: Migration users.0008_stripecustomer dependencies reference nonexistent parent node ('djstripe', '0011_alter_invoice_charge_alter_invoice_customer_and_more')

Our pipeline does not run makemigrations, only migrate, so this seems a little weird that a djstripe migration is created when I run makemigrations locally but then I cannot use it in deployment. Plus, such migration does not exist in djstripe GitHub repository.

dj-stripe version: 2.6.1
Python version: 3.9
Django version: 4.0.1
Stripe API version: 2.68.0
Database type and version: postgres 12.9
karbi
  • 1,770
  • 5
  • 8
Bridge
  • 191
  • 9

1 Answers1

1

It's an known bug in v. 4 - https://github.com/dj-stripe/dj-stripe/issues/1649#issuecomment-1117774629

To solve it you'd have to downgrade django to 3.x.x. They should fix it in the next update as well.

Jannickla
  • 27
  • 5
  • 1
    Thank you. That was my bug report :) I reported it there and asked this question here as well. Unfortunately, downgrade is not an option, but fortunately a workaround was not difficult to implement. – Bridge May 21 '22 at 06:32
  • Good to hear. Could you put some words on what you did? I had to downgrade not to waste too much time on it. – Jannickla May 21 '22 at 15:47
  • I just replaced my FK relation to djstripe's Customer model to a direct Stripe API call to create a customer and then set its id as a CharField on my User model. – Bridge May 30 '22 at 18:35