Albyorix
Albyorix

Reputation: 667

Google AppEngine - Pull Queue - Impossible to delete task: "project name is invalid"

I have create a pull queue in the GAE that works fine, I'm able to add elements from the app & retrieve them from my instance with the code below:

from apiclient.discovery import build
from oauth2client.client import GoogleCredentials

credentials = GoogleCredentials.get_application_default()
PROJECT_NAME = "my-project"
QUEUE_NAME = 'my-queue'

q = build('taskqueue', 'v1beta2', credentials=credentials)
l = q.tasks().lease(project=PROJECT_NAME, taskqueue=QUEUE_NAME, leaseSecs=600, numTasks=1)
result = l.execute()
task = result['items'][0]
task_id = task['id']

The problem comes when I try to delete the task after processing it, this code that should work

d = q.tasks().delete(project=PROJECT_NAME, taskqueue=QUEUE_NAME, task=task_id)
d.execute()

return

File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/googleapiclient/http.py", line 838, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting
https://www.googleapis.com/taskqueue/v1beta2/projects/my-project/taskqueues/my-queue/tasks/46101672956060486431?
returned "project name is invalid">

I don't understand what's wrong because I'm able to get a task from the queue, but when I want to delete it, this error is raised.

Does anyone got an insight ?

Upvotes: 0

Views: 148

Answers (1)

GAEfan
GAEfan

Reputation: 11370

Should be "s~my-project" if your app is in North America, or "e~my-project" if in Europe.

Upvotes: 1

Related Questions