question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dj-stripe creates a strange migration which is not present in 2.6.1 release package or source repo

See original GitHub issue

Describe the bug

I created 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. It’s strange that there are changes in Invoice model that are not reflected in migrations.

Software versions

  • 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

Steps To Reproduce

  1. Install dj-stripe: poetry add dj-stripe
  2. Add djstripe to INSTALLED_APPS
  3. Run manage makemigrations
  4. Run manage migrate
  5. Deploy to AWS

Can you reproduce the issue with the latest version of master? No. Apparently this migration is not created with the latest version of master (2.7.0-alpha.7 ee6b614)

Expected Behavior

All migrations are applied correctly in deployment.

Actual Behavior

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
KennyLeppingcommented, Jun 10, 2022

@eliezerp3 The upcoming release should fix this issue.

I had this same problem and it goes away when I install the latest pre-release version of dj-stripe. When can we expect the next stable release to be up?

@shamjam Hi shamjam! Where did you find the pre-release version? Is it the 2.6.0 pre-release?

Hi @KennyLepping, I’m using the 2.7.0a8 pre-release which I found here.

Awesome, thank you! I will try that. I actually just found a temporary fix that brought my Heroku Django project back online. It was to copy the djstripe app from the site_packages directory into my Django project so I can push the correct migrations to Heroku.

1reaction
jleclanchecommented, Jul 2, 2022

dj-stripe 2.6.2 has been released, containing this fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failure when attempting to upgrade from dj-stripe 2.6.1 to 2.6.2
2. I succeeded to migrate on local development environment, but once deployed on Heroku it doesn't find the last migration file from djstripe...
Read more >
Bountysource
dj-stripe creates a strange migration which is not present in 2.6.1 release package or source repo.
Read more >
dj-stripe referencing a non-existent migration - Stack Overflow
Our pipeline does not run makemigrations , only migrate , so this seems a little weird that a djstripe migration is created when...
Read more >
dj-stripe 2.6 release notes
A manual migration is necessary to convert existing databases from text to json. The DJSTRIPE_PRORATION_POLICY setting is deprecated and will be ignored in...
Read more >
Read the Docs Documentation
After that, click on the green Create repository from template button, ... ensures new package releases will not break your docs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found