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.

UserWarning: Could not determine remote IP (missing REMOTE_ADDR). This is likely an issue with your wsgi/server setup. "Could not determine remote IP (missing REMOTE_ADDR).

See original GitHub issue

Describe the bug See title

Expected behavior Should see customer / plans in the DB, but in gunicorn, im getting

/home/django/local/lib/python3.7/site-packages/djstripe/models/webhooks.py:90: UserWarning: Could not determine remote IP (missing REMOTE_ADDR). This is likely an issue with your wsgi/server setup.
  "Could not determine remote IP (missing REMOTE_ADDR). "
Bad Request: /stripe/webhook/

Webhook log (Screenshot https://i.postimg.cc/BbVB5kfW/image.png)

Header:

{
    "x-forwarded-for": "54.187.205.235",
    "host": "<DJSTRIPE_INSTALLED_DOMAIN>",
    "connection": "close",
    "content-length": "1375",
    "content-type": "application/json; charset=utf-8",
    "cache-control": "no-cache",
    "user-agent": "Stripe/1.0 (+https://stripe.com/docs/webhooks)",
    "accept": "*/*; q=0.5, application/xml",
    "stripe-signature": "t=1586275881,v1=42a21e01ef00491a4176224758e7d8a8815ff4cdff4e2d3e992b1df2d363f608"
}

Body

{
  "id": "evt_1GVIcYDyoyBuHV6eUqjaQWQi",
  "object": "event",
  "api_version": "2019-12-03",
  "created": 1586270503,
  "data": {
    "object": {
      "id": "pm_1GVIcUDyoyBuHV6eytQn1Asz",
      "object": "payment_method",
      "billing_details": {
        "address": {
          "city": null,
          "country": "US",
          "line1": null,
          "line2": null,
          "postal_code": "33912",
          "state": null
        },
        "email": "<CUSTOMER_EMAIL>",
        "name": "<CUSTOMER_NAME>",
        "phone": null
      },
      "card": {
        "brand": "mastercard",
        "checks": {
          "address_line1_check": null,
          "address_postal_code_check": "pass",
          "cvc_check": "pass"
        },
        "country": "US",
        "exp_month": 6,
        "exp_year": 2023,
        "fingerprint": "5BZ5vo4aZ5Q5vIrO",
        "funding": "debit",
        "generated_from": null,
        "last4": "5793",
        "three_d_secure_usage": {
          "supported": true
        },
        "wallet": null
      },
      "created": 1586270502,
      "customer": "cus_H3PRX6Q5Tg0Wqu",
      "livemode": true,
      "metadata": {
      },
      "type": "card"
    }
  },
  "livemode": true,
  "pending_webhooks": 1,
  "request": {
    "id": "req_ihWNUy3FGEfOfB",
    "idempotency_key": null
  },
  "type": "payment_method.attached"
}

Environment

  • dj-stripe version: [e.g. master at <hash>, 2.0.0 etc] - 2.3.0.dev0
  • Your Stripe account’s default API version: 2019-12-03
  • Database: psql (11.5 (Ubuntu 11.5-0ubuntu0.19.04.1))
  • Python version: 3.7.3
  • Django version: 2.2.7

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

I have the latest

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
taewookimcommented, Jun 30, 2020

Took your advice. Was spending way too much time debuggin gunicorn. Decided to move to uwsgi. Much easier. Closing issue.

0reactions
taewookimcommented, Jun 30, 2020

PSA: Use Stripe CLI to trigger webhook events to test. Came in pretty handy

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I get user IP address in Django? - Stack Overflow
This code does not check that the ip from REMOTE_ADDR is private before checking the HTTP_X_FORWARDED_FOR field, as it probably should (also, '127.0.0.1'...
Read more >
gunicorn 19.0: empty remote addr on unix domain socket? #797
Yes. an unix socket has no remote address any more to comply with the CGI/WSGI spec. You will need to check the X-Forwarded...
Read more >
Real Remote (Client) IP Addresses - Fastly Documentation
Without any additional configuration, the agent will use the remote address specified by this HTTP header. While this normally gives correct results, this ......
Read more >
How To Fix the “Server IP Address Could Not Be Found” Error
Learn how to quickly and easily fix the common, yet still frustrating, “Server IP Address Could Not Be Found” Error.
Read more >
mod_remoteip - Apache HTTP Server Version 2.4
In overriding the client IP, the module stores the list of intermediate hosts in a remoteip-proxy-ip-list note, which mod_log_config can record using the ......
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