4👍
✅
Errors like this generally occur when your task depends on some Python path manipulation or other jiggery-pokery that isn’t being carried out when the first request to a runtime is via deferred. You need to make sure that all your entry points – eg, the module containing the function you’re deferring – import a module that does the relevant path manipulation.
Alternatively, you can write your own deferred task handler, which, being part of your framework, will already have the relevant patches applied. For that, simply register the handler and have it call deferred.run(), passing in the complete body of the request.
Source:stackexchange.com