Skip to content
This repository has been 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
BaiJiangJie opened this issue Aug 30, 2021 · 7 comments
Assignees
Labels
api: compute Issues related to the googleapis/python-compute API. external This issue is blocked on a bug with the actual product. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@BaiJiangJie
Copy link

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!

@BaiJiangJie BaiJiangJie changed the title An error was reported getting the regions list An error was reported getting the regions list (Invalid enum value SERVICE_ATTACHMENTS) Aug 30, 2021
@busunkim96 busunkim96 transferred this issue from googleapis/google-api-python-client Aug 30, 2021
@product-auto-label product-auto-label bot added the api: compute Issues related to the googleapis/python-compute API. label Aug 30, 2021
@busunkim96
Copy link
Contributor

busunkim96 commented Aug 30, 2021

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.

@busunkim96 busunkim96 added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Aug 30, 2021
@busunkim96
Copy link
Contributor

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

@busunkim96
Copy link
Contributor

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

@vchudnov-g
Copy link
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.

@vam-google
Copy link

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

@busunkim96
Copy link
Contributor

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

@vam-google
Copy link

This should have been fixed by #147

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: compute Issues related to the googleapis/python-compute API. external This issue is blocked on a bug with the actual product. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

4 participants