Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

An error was reported getting the regions list (Invalid enum value SERVICE_ATTACHMENTS) #111

Closed

Description

@baijiangjie

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS type and version:
  • Python version: Python 3.8.6
  • pip version: pip 20.2.1
  • google-api-python-client version: Version: 2.18.0

Steps to reproduce

  1. Create RegionsClient
  2. Get regions list

Code example

# example
regions_client = RegionsClient.from_service_account_info(info=info)
regions_client.list(project=project_id)

Stack trace

# example
Traceback (most recent call last):
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/Users/jiangjiebai/Bai/Project/Jumpserver/jumpserver/apps/xpack/plugins/cloud/api.py", line 35, in get
    validity, error = account.is_valid(return_tuples=True)
  File "/Users/jiangjiebai/Bai/Project/Jumpserver/jumpserver/apps/xpack/plugins/cloud/models.py", line 60, in is_valid
    return self.provider_instance.is_valid(return_tuples=return_tuples)
  File "/Users/jiangjiebai/Bai/Project/Jumpserver/jumpserver/apps/xpack/plugins/cloud/providers/gcp.py", line 33, in is_valid
    return self.get_regions()
  File "/Users/jiangjiebai/Bai/Project/Jumpserver/jumpserver/apps/xpack/plugins/cloud/providers/gcp.py", line 29, in get_regions
    regions = self.regions_client.list(project=self.project)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/google/cloud/compute_v1/services/regions/client.py", line 467, in list
    response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py", line 142, in __call__
    return wrapped_func(*args, **kwargs)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/google/api_core/grpc_helpers.py", line 66, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/google/cloud/compute_v1/services/regions/transports/rest.py", line 202, in list
    return compute.RegionList.from_json(
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/proto/message.py", line 374, in from_json
    Parse(payload, instance._pb, ignore_unknown_fields=ignore_unknown_fields)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/google/protobuf/json_format.py", line 434, in Parse
    return ParseDict(js, message, ignore_unknown_fields, descriptor_pool)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/google/protobuf/json_format.py", line 454, in ParseDict
    parser.ConvertMessage(js_dict, message)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/google/protobuf/json_format.py", line 485, in ConvertMessage
    self._ConvertFieldValuePair(value, message)
  File "/Users/jiangjiebai/.virtualenv/corePy3.8/lib/python3.8/site-packages/google/protobuf/json_format.py", line 597, in _ConvertFieldValuePair
    raise ParseError('Failed to parse {0} field: {1}.'.format(name, e))
google.protobuf.json_format.ParseError: Failed to parse items field: Failed to parse quotas field: Invalid enum value SERVICE_ATTACHMENTS for enum type google.cloud.compute.v1.Quota.Metric...

I checked v2.18.0 to add SERVICE_ATTACHMENTS option in file (compute.v1.json), but switch to V2.17.0 also reported the same error

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Activity

  1. changed the title [-]An error was reported getting the regions list[/-] [+]An error was reported getting the regions list (Invalid enum value SERVICE_ATTACHMENTS)[/+] on Aug 30, 2021
  2. busunkim96 commented on Aug 30, 2021

    @busunkim96
    Contributor

    Hi @baijiangjie,

    Thank you for filing an issue.

    From the code sample and stack trace you provided it looks like you're using google-cloud-compute so I've transferred the issue to this repository.

    I'm able to reproduce the error locally with this sample and the latest version of google-cloud-compute:

    from google.cloud import compute_v1
    
    regions_client = compute_v1.RegionsClient()
    regions_client.list(project="my-project-id")

    I looked through the generated docstrings and https://googleapis.dev/python/compute/latest/compute_v1/types.html#google.cloud.compute_v1.types.Quota.Metric does not have SERVICE_ATTACHMENTS. The discovery doc does have this enum value.

    @vchudnov-g @software-dov This looks like an instance of the unknown enum responses bug.

  3. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    on Aug 30, 2021
  4. busunkim96 commented on Aug 30, 2021

    @busunkim96
    Contributor

    Triaged as P1 since it makes the function unusable until a new version of the library is released.

  5. busunkim96 commented on Sep 9, 2021

    @busunkim96
    Contributor

    @vchudnov-g @vam-google Are there any plans to update the compute protos in https://github.com/googleapis/googleapis-discovery?

  6. vchudnov-g commented on Sep 9, 2021

    @vchudnov-g
    Contributor

    @vam-google We should do that right away so we can re-generate updated libraries. We were already planning on having updated libraries by Monday in most languages.

  7. vam-google commented on Sep 10, 2021

    @vam-google

    @busunkim96 I'm working on regenerating compute protos right now. The clients generated from new protos should not have this problem anymore.

  8. added
    externalThis issue is blocked on a bug with the actual product.
    on Sep 14, 2021
  9. busunkim96 commented on Sep 14, 2021

    @busunkim96
    Contributor

    Marking as external since the immediate fix is to re-generate the protos and the long-term fix is to fix the generator.

  10. vam-google commented on Nov 22, 2021

    @vam-google

    This should have been fixed by #147

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

Metadata

Metadata

Labels

api: computeIssues related to the googleapis/python-compute API.externalThis issue is blocked on a bug with the actual product.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions