While trying to pass a file off to a Celery task, I am sometimes getting the exception "cannot serialize '_io.BufferedReader' object". This seems to be happening with some files and not others. The endpoint is an APIView with the following to launch the task:
from celery import signature
task = signature(
data.get('action'),
kwargs={'data': data,
'authorization': authorization,
"files": files}
).apply_async()
It does work fine when some files are included in the request, but throws the exception for other files.