Skip to content

PubSub: Bad error message when message attribute is too long #7906

@mlucy

Description

@mlucy

Environment details

  1. Specify the API at the beginning of the title (for example, "BigQuery: ...")
    General, Core, and Other are also allowed as types

PubSub

  1. OS type and version

Ubuntu 16.04.6 LTS (Xenial Xerus)

  1. Python version and virtual environment information: python --version

Python 2.7.12

  1. google-cloud- version: pip show google-<service> or pip freeze

google-cloud-pubsub==0.40.0

Steps to reproduce

  1. Send a message with an attribute that is too long.
  2. The error message will be bad. It will say "One of the attributes in the request has a 2000 that is too long. The length is 1024 characters, but the maximum allowed is value. Refer to https://cloud.google.com/pubsub/quotas for more information." instead of "One of the attributes in the request has a value that is too long. The length is 2000 characters, but the maximum allowed is 1024. Refer to https://cloud.google.com/pubsub/quotas for more information."

Code example

from google.cloud import pubsub_v1

publisher = pubsub_v1.PublisherClient()
path = publisher.topic_path(PROJECT_ID, TOPIC_PATH)
future = publisher.publish(path, '', foo=('a'*2000))
raise future.exception()

Stack trace

>>> Traceback (most recent call last):                                                               
  File "<stdin>", line 1, in <module>                                                                
  File "/tmp/repro.py", line 9, in <module>                                                          
    raise future.exception()                                                                         
google.api_core.exceptions.InvalidArgument: 400 One of the attributes in the request has a 2000 that is too long. The length is 1024 characters, but the maximum allowed is value. Refer to https://cloud.google.com/pubsub/quotas for more information.                                                     

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.backendtype: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions