Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration being created for WebhookEndpoint.api_version #2112

Open
garyj opened this issue Oct 22, 2024 · 1 comment
Open

Migration being created for WebhookEndpoint.api_version #2112

garyj opened this issue Oct 22, 2024 · 1 comment
Labels
Milestone

Comments

@garyj
Copy link

garyj commented Oct 22, 2024

Describe the bug
After adding dj-stripe 2.9.0b0 to the project and running makemigrations, the command tries to create a migration in dj-stripe package.

To Reproduce

  • Add 2.9.0b0 to the project poetry add dj-stripe@2.9.0b0
    • This will also install stripe version 11.1.1
  • Run manage.py makemigrations
    • if in docker container the error will be something like PermissionError: [Errno 13] Permission denied: '/opt/pysetup/.venv/lib/python3.12/site-packages/djstripe/migrations/0014_alter_webhookendpoint_api_version.py'

Changing the permissions to allow the migration to be create will create the following

class Migration(migrations.Migration):

    dependencies = [
        ('djstripe', '0013_2_9'),
    ]

    operations = [
        migrations.AlterField(
            model_name='webhookendpoint',
            name='api_version',
            field=models.CharField(blank=True, default='2024-09-30.acacia', help_text='The API version events are rendered as for this webhook endpoint. Defaults to the configured Stripe API Version.', max_length=64),
        ),
    ]

I did not set STRIPE_API_VERSION not DEFAULT_STRIPE_API_VERSION in my apps settings.

The default was introduced in ddf4b5. Which calls STRIPE_API_VERSION code in settings.py which defaults to stripe.api_version when STRIPE_API_VERSION is not set in settings.py. Hence in my case that resulted in 2024-09-30.acacia.

Digging a bit further I can see that in this migration the version defaults to 2024-04-10. Which is contradictory to settings.py which sets the DEFAULT_STRIPE_API_VERSION to 2020-08-27

So basically to avoid this migration being created I can set STRIPE_API_VERSION = '2024-04-10' in my settings.py.

Software versions

  • Dj-Stripe version: 2.9.0b0
  • Python version: 3.12.6
  • Django version: 5.1.2
  • Stripe API version: 11.1.1
  • Database type and version: Postgres 15
@garyj garyj added the bug label Oct 22, 2024
@dbartenstein
Copy link

dbartenstein commented Dec 2, 2024

@jleclanche do the webhooks with djstripe 2.9.x also work with newer API-versions or should they still be set to "2020-08-27"?

@jleclanche jleclanche added this to the 2.10 milestone Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants