0

In my Heroku Django app, for the user account registration flow, there is a typical request activate account that happens when the user receives an email with a special "activate" URL. In the app, this activation should happen only once. The only identifier on that URL is an activation token. The token is used to "activate" the account, and also to identify the user (retrieve his username from the DB). Once this token is used, it is deleted.

For that reason, activation must happen only once. However, for really odd reasons, when the request is sent to my Heroku app, it triggers the activate function twice. I am quite sure this is not a programming mistake in the app, because on local development the activation is not called twice, and neither on staging environment (which is on Heroku too, almost identical to production settings). It only happens in production.

Here is what I see in heroku logs: http://pastebin.com/QeuP74fa

The first quarter of this log is interesting. Notice that at some point activation succeeded and attempted to redirect the user to the next correct page: GET Request to /iro/dashboard. But then after that the activation request happens, hence the crash that you see related to a "NoneType" object has no attribute...

My Procfile looks like this

web: newrelic-admin run-program gunicorn --bind=0.0.0.0:$PORT --workers=1 --log-level=debug iroquote.wsgi:application
worker: python manage.py rqworker high default low

I had 2 web dynos running, and 1 worker dyno, when I found the bug. I have tried to scale down to 1 web dyno and 1 worker, same bug. Then 0 dynos at all, and restarted 1 web dyno, still 0 worker, same bug.

Might something related to the Heroku router calling the dyno twice, or might not.

Help?

André Staltz
  • 13,304
  • 9
  • 48
  • 58

1 Answers1

0

Silently, it stopped happening. This was likely a routing problem in Heroku that affected my app.

André Staltz
  • 13,304
  • 9
  • 48
  • 58