Tasks: GAE Flex, INVALID_ARGUMENT, "x-goog-request-params"
See original GitHub issueI am trying to create tasks from a flex application environment with the following code:
from google.cloud import tasks_v2beta2
def create_task(project= PROJECT_ID, queue= QUEUE, location= QLOCATION, payload= None):
"""Create a task for a given queue with an arbitrary payload."""
# Create a client.
client = tasks_v2beta2.CloudTasksClient()
# Construct the request body.
task = {
'app_engine_http_request': { # Specify the type of request.
'http_method': 'POST',
'relative_url': '/bootstrapper'
}
}
if payload is not None:
# The API expects a payload of type bytes.
converted_payload = payload.encode()
# Add the payload to the request.
task['app_engine_http_request']['payload'] = converted_payload
# Construct the fully qualified queue name.
parent = client.queue_path(project, location, queue)
# Use the client to build and send the task.
response = client.create_task(parent, task)
print('Created task {}'.format(response.name))
return response
create_task(payload="foo")
Stack Trace from Error Reporting:
Traceback (most recent call last):
File "/env/lib/python3.6/site-packages/google/api_core/grpc_helpers.py", line 54, in error_remapped_callable
return callable_(*args, **kwargs)
File "/env/lib/python3.6/site-packages/grpc/_channel.py", line 500, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/env/lib/python3.6/site-packages/grpc/_channel.py", line 434, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.INVALID_ARGUMENT, "x-goog-request-params" header is either missing or misformatted. "x-goog-request-params" must contain "parent=projects/sample_id/locations/sample_location/queues/foo_queue")>
I looked up online and I found similar error being addressed in the Ruby Client Lib, I am not sure if the same bug exisits in python client library as well.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Google App Engine flexible environment docs
Offers users the ability to build and host web applications on Google's infrastructure.
Read more >Cloud Tasks API for python2.7 google app engine
The "Cloud Tasks API" provides a REST API that you can use to add tasks from a second generation App Engine standard environment...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I don’t exactly remember but app engine service id or name was added to the task body as follows:
'service':'foo'
To the body itself? not the appEngineHttpRequest as header? or the appEngineRouting object as service?