Forums

Stripe error

I get the following error every time I post to Stripe:

    2017-09-25 18:14:15,586: message='Request to Stripe api' method=post path=https://api.stripe.com/v1/customers
    2017-09-25 18:14:16,223: message='Stripe API response' path=https://api.stripe.com/v1/customers response_code=200
    2017-09-25 18:14:16,238: message='Request to Stripe api' method=post path=https://api.stripe.com/v1/customers/cus_xxxxxxxxx/sources
    2017-09-25 18:14:17,848: message='Stripe API response' path=https://api.stripe.com/v1/customers/cus_xxxxxxxx/sources response_code=200
    2017-09-25 18:14:17,855: message='Request to Stripe api' method=post path=https://api.stripe.com/v1/subscriptions
    2017-09-25 18:14:18,602: message='Stripe API response' path=https://api.stripe.com/v1/subscriptions response_code=200
    2017-09-25 18:14:18,677: OSError: write error
    2017-09-25 18:14:18,677: Error running WSGI application
    2017-09-25 18:14:18,678: GeneratorExit

I've seen post about how to not be worried about the OSError, but this is concerning since it's regarding payments. As you can see from the time stamps, it's immediately following a succesful 200 response. Is this to be expected?

Cross reference that log with your access log, you should be able to see whether it's always happening for the same URL, in which case it may be an issue with that view.

Yes, it always happens with the call to Stripe, but I'm getting a 200 back, I'm just trying to figure out what the error really means and why it's happening.

This doesn't happen locally, only on PythonAnywhere.

The write error/generator exit means that someone navigated to your page, and while your page was still loading, they navigated away by clicking refresh or clicking a link, or by going to a different url.

Glenn meant that it might be an issue with the view because maybe some view in particular is taking a long time to load, hence getting cut off midway frequently.

Got it, but this happens every time I call Stripe and happens even when you stay on the page until it's finished loading (I've tested it). The page loads and completes the call to Stripe pretty fast (< 2 seconds), so it that doesn't seem to be the issue.

i see- maybe put in some prints in different places to see where it's breaking? this sounds hard to debug without looking into the code etc.