django-cloud-tasks icon indicating copy to clipboard operation
django-cloud-tasks copied to clipboard

Trouble getting the quickstart example to work.

Open geoffwalmsley opened this issue 4 years ago • 6 comments

When I run the quickstart example, I get the following error:

'tuple' object has no attribute 'get'

in relating to this line in base.py: self._task_handler_url = task_handler_url or DCTConfig.task_handler_root_url()

Would it be possible to work on this together? I'm really keen to get something working to use cloud tasks with django. Many thanks!

geoffwalmsley avatar Sep 05 '19 13:09 geoffwalmsley

Exactly the same message for me! (Python 3.7 / Dango 2.2.4)

SprigganCG avatar Sep 18 '19 16:09 SprigganCG

That's because in the example, it says to add to settings.py the dictionary called DJANGO_CLOUD_TASKS, And after this dictionary there is a comma which makes it a tuple. Remove the comma and you'll be able to continue.

kalsky avatar Oct 29 '19 03:10 kalsky

Another thing that is not documented is that you also need to have the following key in your settings.py: DJANGO_CLOUD_TASKS_HANDLER_SECRET = 'some_secret_key' This value will be added to the task and when it needs to run it, the code will validate that it's the same value that is defined in your settings. This is to somehow prevent other tasks getting into your queue. Without this key - you'll just see the tasks keep retrying, and if you'll look at the logs, you'll see it complains about 'API key mismatch'.

kalsky avatar Oct 30 '19 05:10 kalsky

Anyone, please email to a repository owner to merge the pull request.

Thank you

adityabhalsod avatar Oct 20 '20 12:10 adityabhalsod

Another thing that is not documented is that you also need to have the following key in your settings.py: DJANGO_CLOUD_TASKS_HANDLER_SECRET = 'some_secret_key' This value will be added to the task and when it needs to run it, the code will validate that it's the same value that is defined in your settings. This is to somehow prevent other tasks getting into your queue. Without this key - you'll just see the tasks keep retrying, and if you'll look at the logs, you'll see it complains about 'API key mismatch'.

That thing was really painful for me until saw your comment dude. You are really an angel... Repository owner must write about that in instructions.

ahmetozleraktas avatar Jan 20 '21 21:01 ahmetozleraktas

Im getting some trouble too when i run the task im getting this error

googleapiclient.errors.HttpError: <HttpError 403 when requesting https://cloudtasks.googleapis.com/v2beta3/projects/%7Bdeployement-test%7D/locations/europe-west1/queues/default/tasks?alt=json returned "Permission denied on resource project {deployement-test}.". Details: "[{'@type': 'type.googleapis.com/google.rpc.Help', 'links': [{'description': 'Google developer console API key', 'url': 'https://console.developers.google.com/project/{deployement-test}/apiui/credential'}]}, {'@type': 'type.googleapis.com/google.rpc.ErrorInfo', 'reason': 'CONSUMER_INVALID', 'domain': 'googleapis.com', 'metadata': {'consumer': 'projects/{deployement-test}', 'service': 'cloudtasks.googleapis.com'}}]">

reason : 'CONSUMER_INVALID' maybe its related too DJANGO_CLOUD_TASKS_HANDLER_SECRET , i try to add it but i dont know if im doing it with the correct way , and from where i can get it

Altarois avatar Sep 07 '21 10:09 Altarois