2021年1月25日星期一

google cloud task app engine with relative uri throws invalidargument exception

I am trying to create a task using google cloud task using the python client google-cloud-tasks==2.1.0 but I am getting an exception that HttpRequest.url is required. I am setting relative url which is a url handling the task in my app. The queue exists and has been created using:

gcloud task create queue notifications

         client = tasks_v2.CloudTasksClient()           parent = client.queue_path(project, location, queue)           task = {                                                                               'app_engine_http_request': {                                                           'http_method': tasks_v2.HttpMethod.POST,                                           'relative_uri': notification_url,                   'body': payload.encode('utf-8')                                      },                                                                                 'http_request': {                                                                      'headers': {"Content-type": "application/json"}                                }                                                                              }           response = client.create_task(parent=parent, task=task)  

The exact error that I receive is:

google.api_core.exceptions.InvalidArgument: 400 HttpRequest.url is required

I am trying to create task in my app engine standard environment.

https://stackoverflow.com/questions/65891363/google-cloud-task-app-engine-with-relative-uri-throws-invalidargument-exception January 26, 2021 at 03:41AM

没有评论:

发表评论