Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading error message when user is missing permissions #342

Closed
rjrudin opened this issue Feb 17, 2022 · 4 comments · Fixed by #355
Closed

Misleading error message when user is missing permissions #342

rjrudin opened this issue Feb 17, 2022 · 4 comments · Fixed by #355
Labels
api: bigquery Issues related to the BigQuery API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@rjrudin
Copy link

rjrudin commented Feb 17, 2022

Environment details

  • OS type and version: MacOS 11.6.2
  • Python version: 3.9.9
  • pip version: 20.3.4
  • pandas-gbq version: 0.17.0

Steps to reproduce

  1. Create a service account that has the "BigQuery Data Editor" and "BigQuery JobUser" roles (these are not sufficient for using read_gbq; it's a user error to use them, but the focus of this ticket is that the helpful error message gets lost):
  2. Invoke pandas_gbq.read_gbq with params that should work - i.e. they'd work fine if the user had the "BigQuery User" role

You'll get this error:

>       if isinstance(rpc_exc, grpc.Call) or _is_informative_grpc_error(rpc_exc):
E       AttributeError: 'NoneType' object has no attribute 'Call'

The actual error is visible in the traceback:

E           grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
E           	status = StatusCode.PERMISSION_DENIED
E           	details = "request failed: the user does not have 'bigquery.readsessions.create' permission for 'projects/redacted'"

The "NoneType has no attribute" message is misleading and obscures the problem. I believe the error should be reporting the permission issue that is captured in the above block.

Again, this is ultimately a user error due to the wrong permissions being used, but a user will find that out more quickly by getting back the actual error instead of the "NoneType has no attribute" error.

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the BigQuery API. label Feb 17, 2022
@tswast tswast added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Feb 17, 2022
@tswast
Copy link
Contributor

tswast commented Feb 17, 2022

Thanks for the report! I just saw someone report a similar issue on a related library here: googleapis/python-bigquery-reservation#201

I suspect this is an issue with error translations in the API core library. Moving this issue there.

@tswast tswast transferred this issue from googleapis/python-bigquery-pandas Feb 17, 2022
@tswast
Copy link
Contributor

tswast commented Feb 17, 2022

Possible duplicate of #309, though this issue may be easier to reproduce.

@rjrudin It'd be helpful if you could share the output of pip freeze and/or conda list so that we can check if there's some version incompatibilities we need to be considering.

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Feb 18, 2022
@parthea
Copy link
Collaborator

parthea commented Feb 27, 2022

This appears to be related to #301

@parthea parthea added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Feb 27, 2022
@parthea
Copy link
Collaborator

parthea commented Feb 27, 2022

Assigning p2 as the current workaround is to install grpcio-status

@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Feb 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants