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 476 forks source link

Webhook form failing validation for docker stripe/cli #1990

Closed levimoore1992 closed 8 months ago

levimoore1992 commented 8 months ago

Describe the bug When saving a webhook the form validation fails in the post_clean method raising

KeyError at /admin/djstripe/webhookendpoint/add/
'base_url'

To Reproduce Steps to reproduce the behavior: Make sure your app is running from a docker service

create a container like

 stripe-cli:
        image: stripe/stripe-cli:latest
        command: "listen --api-key ${STRIPE_SECRET_KEY} --forward-to web:8000/payments/webhook/ --skip-verify"
        env_file:
            - .env

make your settings have these values

# Stripe Settings
STRIPE_LIVE_MODE = not DEBUG  # Live Mode is the opposite of DEBUG mode
DJSTRIPE_USE_NATIVE_JSONFIELD = True
DJSTRIPE_FOREIGN_KEY_TO_FIELD = "id"
DJSTRIPE_WEBHOOK_SECRET = os.getenv("DJSTRIPE_WEBHOOK_SECRET")

then go into your admin

go to the add webhook form and type web:8000 (which is required for Docker setup) and then click save

Expected behavior That the form saves and creates the field

Environment

Can you reproduce the issue with the latest version of master?

Yes