Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

pubsub messages are twice base64 encoded when using GAX #2577

Copy link
Copy link

Description

@ericbuehl
Issue body actions

I am using a recent master (85a0c1a)

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 12:54:16) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

$ pip show google-cloud-pubsub

---
Metadata-Version: 2.0
Name: google-cloud-pubsub
Version: 0.20.0+85a0c1a
Summary: Python Client for Google Cloud Pub/Sub
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google Cloud Platform
Author-email: jjg+google-cloud-python@google.com
Installer: pip
License: Apache 2.0
Location: /Users/eric/env/lib/python2.7/site-packages
Requires: google-cloud-core, grpc-google-pubsub-v1, gapic-google-pubsub-v1, grpcio, google-gax
Classifiers:
  Development Status :: 4 - Beta
  Intended Audience :: Developers
  License :: OSI Approved :: Apache Software License
  Operating System :: OS Independent
  Programming Language :: Python :: 2
  Programming Language :: Python :: 2.7
  Programming Language :: Python :: 3
  Programming Language :: Python :: 3.4
  Programming Language :: Python :: 3.5
  Topic :: Internet

To demonstrate this issue, I set up a simple pubsub push endpoint that prints the posted data.

$ python
>>> from google.cloud import pubsub
>>> pubsub.Client("myproject").topic("mytopic").publish("blah")

Data received at push endpoint:

{u'message': {u'attributes': {},
              u'data': u'WW14aGFBPT0=',
...

$ GOOGLE_CLOUD_DISABLE_GRPC=1 python
>>> from google.cloud import pubsub
>>> pubsub.Client("myproject").topic("mytopic").publish("blah")

Data received at push endpoint:

{u'message': {u'attributes': {},
              u'data': u'YmxhaA==',
...

As you can see, the data in the first version is a twice-encoded version of the message "blah" while GAX is in use. I would expect to see the latter regardless of GAX being enabled or not.


(Added by @dhermes)

>>> import base64
>>> base64.b64decode(u'WW14aGFBPT0=')
'YmxhaA=='
>>> base64.b64decode('YmxhaA==')
'blah'
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.