I have an App Engine service with ingress control set internal-only so it is accessible only from google services within the project.
Through a cloud function I create a task to be routed to the App Engine, but when the task is processed by Cloud Tasks Service the error that is generated is that target is 'UNAVAILABLE'.
If I put back ingress control for all, all works correctly. Am I missing something?
Here is the code of the task creation
task = {
'http_request': {
'http_method': tasks_v2.HttpMethod.POST,
'url': url,
},
}
response = client.create_task(request={'parent': parent, 'task': task})
Have you tried doing it as an Appengine Task instead of an HTTP Target Task?
https://cloud.google.com/tasks/docs/creating-appengine-tasks
So something like this:
task = {
'app_engine_http_request': {
'http_method': tasks_v2.HttpMethod.POST,
'relative_uri': relative_uri,
},
}
response = client.create_task(request={'parent': parent, 'task': task})