Probably you are hitting the gunicorn timeout as it should take a while to export the records. IIRC the default timeout is 60seconds, so if you get the error after waiting such time this confirms my teory. In this case you will find the solution here: