question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tasks: GAE Flex, INVALID_ARGUMENT, "x-goog-request-params"

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
thakursc1-zzcommented, Oct 25, 2018

I don’t exactly remember but app engine service id or name was added to the task body as follows: 'service':'foo'

0reactions
moshevicommented, Oct 25, 2018

To the body itself? not the appEngineHttpRequest as header? or the appEngineRouting object as service?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found