GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Can't reach GCP PubSub Emulator · Issue #825 · googleapis/python-pubsub

This repository was archived by the owner on Oct 13, 2026. It is now read-only.
This repository was archived by the owner on Oct 13, 2026. It is now read-only.

Can't reach GCP PubSub Emulator #825

Copy link
Copy link
Closed
Closed
Can't reach GCP PubSub Emulator#825
Copy link
Assignees
acocuzzo
Labels
api: pubsubIssues related to the googleapis/python-pubsub API.type: questionRequest for information or clarification. Not an issue.

Description

@PabloRR100
PabloRR100
opened on Nov 17, 2022
Issue body actions

I have setup the PubSub emulator to run a Python script locally pointing to it.
The emulator is run following the tutorial and it seems to be working fine:

➜ gcloud beta emulators pubsub start --project=tokyo-rain-123 --host-port=127.0.0.1:8085
Executing: /Users/pabloruiz/Downloads/google-cloud-sdk/platform/pubsub-emulator/bin/cloud-pubsub-emulator --host=127.0.0.1 --port=8085
[pubsub] This is the Google Pub/Sub fake.
[pubsub] Implementation may be incomplete or differ from the real system.
[pubsub] Nov 17, 2022 3:32:04 PM com.google.cloud.pubsub.testing.v1.Main main
[pubsub] INFO: IAM integration is disabled. IAM policy methods and ACL checks are not supported
[pubsub] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[pubsub] SLF4J: Defaulting to no-operation (NOP) logger implementation
[pubsub] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[pubsub] Nov 17, 2022 3:32:04 PM com.google.cloud.pubsub.testing.v1.Main main
[pubsub] INFO: Server started, listening on 8085

It is working fine using curl:

➜ curl -X PUT http://localhost:8085/v1/projects/tokyo-rain-123/topics/topic-data1
{
  "name": "projects/tokyo-rain-123/topics/topic-data1"
}

Although it is displaying this warning on the emulator:

[pubsub] INFO: Server started, listening on 8085
[pubsub] Nov 17, 2022 4:00:57 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[pubsub] INFO: Detected non-HTTP/2 connection.
[pubsub] Nov 17, 2022 4:00:57 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[pubsub] INFO: Detected HTTP/2 connection.

If I try it with the Python client, it just never reaches the server, since I can't see anything in the logs. This is the Python scripts:

import logging
import os
from dotenv import load_dotenv
from google.cloud import pubsub_v1

load_dotenv()
logger = logging.getLogger(__name__)

HOST, PROJECT_ID = os.environ.get("PUBSUB_EMULATOR_HOST"), os.environ.get("PUBSUB_PROJECT_ID")
print(f"Host: {HOST}, Project ID: {PROJECT_ID}")

publisher = pubsub_v1.PublisherClient()

def list_topics(project_id):
    project_path = f"projects/{project_id}"
    all_topics = list(publisher.list_topics(
        request={"project": project_path},
        timeout=5
    ))
    print(f"Found {len(all_topics)}")
    return all_topics


logger.info("Listing topics for project:")
topics = list_topics(project_id=PROJECT_ID)
for topic in topics:
    logger.info(topics)

which is just printing the correct env variables, but the client never gets a response for the rpc call.

Host: [::1]:8085, Project ID: tokyo-rain-123

Any idea why this is happening ?

Thanks in advance !

Activity

  1. product-auto-label
    added
    api: pubsubIssues related to the googleapis/python-pubsub API.
    on Nov 17, 2022
  2. acocuzzo commented on Nov 23, 2022

    @acocuzzo
    acocuzzo
    on Nov 23, 2022
    Contributor
    More actions

    Please set the host to localhost:8085 to match the hostname the emulator is running on.

  3. acocuzzo
    self-assigned this
    on Nov 23, 2022
  4. acocuzzo
    added
    type: questionRequest for information or clarification. Not an issue.
    on Nov 23, 2022
  5. acocuzzo
    closed this as completedon Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @acocuzzo
    acocuzzo

Labels

api: pubsubIssues related to the googleapis/python-pubsub API.type: 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

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.