GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Generated clients are missing routing headers · Issue #401 · googleapis/gapic-generator-python

This repository was archived by the owner on Aug 25, 2026. It is now read-only.
This repository was archived by the owner on Aug 25, 2026. It is now read-only.

Generated clients are missing routing headers #401

Copy link
Copy link
Closed
#1133
#443
Closed
Generated clients are missing routing headers#401
#1133
#443
Copy link
Assignees
software-dov
Labels
conversion blockingA surface delta, bug, missing feature, or other issue that prevents API conversionpriority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.

Description

@busunkim96
busunkim96
opened on Apr 22, 2020
Issue body actions

https://aip.dev/client-libraries/4222

It looks like the generator is not adding variables declared in the google.api.http annotation to routing headers.

https://github.com/googleapis/googleapis/blob/52701da10fec2a5f9796e8d12518c0fe574488fe/google/cloud/servicedirectory/v1beta1/registration_service.proto#L60-L65

See https://github.com/GoogleCloudPlatform/python-docs-samples/pull/3456/files#r412305714 for the modifications that need to be made to currently use the library.

Possibly related to #380.

Metadata should be added somewhere here (see this method for comparison))

Activity

  1. busunkim96
    assigned
    software-dov
    on Apr 22, 2020
  2. hkdevandla
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Apr 22, 2020
  3. software-dov commented on May 1, 2020

    @software-dov
    software-dov
    on May 1, 2020
    Contributor
    More actions

    Just to clarify, is this an issue being seen with microgenerated client libraries?

  4. busunkim96 commented on May 1, 2020

    @busunkim96
    busunkim96
    on May 1, 2020
    ContributorAuthor
    More actions

    @software-dov Yep! google-cloud-service-directory

  5. rebeccawshaw commented on May 18, 2020

    @rebeccawshaw
    rebeccawshaw
    on May 18, 2020
    More actions

    Hi, is there any update on this bug? We need to get the python snippets in before our GA launch, as this is currently one of our blockers.

  6. busunkim96
    added
    conversion blockingA surface delta, bug, missing feature, or other issue that prevents API conversion
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    and removed
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Jun 4, 2020
  7. busunkim96 commented on Jun 4, 2020

    @busunkim96
    busunkim96
    on Jun 4, 2020
    ContributorAuthor
    More actions

    Bumping the priority on this as I'm seeing the same issue with KMS.

    Errors look like:

    EDIT: Looks like this is slightly different (perhaps related to pagination?). I don't see the error with my test project which has fewer resources.

    E           grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
    E               status = StatusCode.NOT_FOUND
    E               details = "The request concerns location 'us-east1' but was sent to location 'global'. Either Cloud KMS is not available in 'us-east1' or the request was misrouted. Make sure the 'x-goog-request-params' metadata is set correctly; see https://cloud.google.com/kms/docs/grpc for more information."
    E               debug_error_string = "{"created":"@1591243631.459760738","description":"Error received from peer ipv4:74.125.142.95:443","file":"src/core/lib/surface/call.cc","file_line":1056,"grpc_message":"The request concerns location 'us-east1' but was sent to location 'global'. Either Cloud KMS is not available in 'us-east1' or the request was misrouted. Make sure the 'x-goog-request-params' metadata is set correctly; see https://cloud.google.com/kms/docs/grpc for more information.","grpc_status":5}"
    E           >
    
  8. busunkim96 commented on Jun 4, 2020

    @busunkim96
    busunkim96
    on Jun 4, 2020
    ContributorAuthor
    More actions

    The original issue with service_directory seems to be that the generator currently adds the metadata only for http.get. The methods missing metadata are of other types: patch, delete, post

      // Creates a namespace, and returns the new Namespace.
      rpc CreateNamespace(CreateNamespaceRequest) returns (Namespace) {
        option (google.api.http) = {
          post: "/v1beta1/{parent=projects/*/locations/*}/namespaces"
          body: "namespace"
        };
        option (google.api.method_signature) = "parent,namespace,namespace_id";
      }

    gapic-generator-python/gapic/schema/wrappers.py

    Lines 624 to 630 in 5f4c300

    @property
    def field_headers(self) -> Sequence[str]:
    """Return the field headers defined for this method."""
    http = self.options.Extensions[annotations_pb2.http]
    if http.get:
    return tuple(re.findall(r'\{([a-z][\w\d_.]+)=', http.get))
    return ()

    gapic-generator-python/gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2

    Lines 331 to 340 in 41fa725

    # Certain fields should be provided within the metadata header;
    # add these here.
    metadata = tuple(metadata) + (
    gapic_v1.routing_header.to_grpc_metadata((
    {%- for field_header in method.field_headers %}
    ('{{ field_header }}', request.{{ field_header }}),
    {%- endfor %}
    )),
    )
    {%- endif %}

  9. software-dov
    closed this as completedin #443on Jun 9, 2020
  10. software-dov
    added a commit that references this issue on Jun 9, 2020

    fix: add field headers for other http verbs (#443)

    This issue will close once commit f8e9712 is merged into the 'main' branch.
    f8e9712
  11. software-dov commented on Jun 9, 2020

    @software-dov
    software-dov
    on Jun 9, 2020
    Contributor
    More actions

    Fixed by #443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @software-dov
    software-dov

Labels

conversion blockingA surface delta, bug, missing feature, or other issue that prevents API conversionpriority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.