Skip to content

Misleading error message when user is missing permissions #342

Closed
@rjrudin

Description

@rjrudin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigqueryIssues related to the BigQuery API.priority: p2Moderately-important priority. Fix may not be included in 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