Title: Can't reach GCP PubSub Emulator · Issue #825 · googleapis/python-pubsub · GitHub
Open Graph Title: Can't reach GCP PubSub Emulator · Issue #825 · googleapis/python-pubsub
X Title: Can't reach GCP PubSub Emulator · Issue #825 · googleapis/python-pubsub
Description: 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...
Open Graph Description: 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 --pr...
X Description: 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 --pr...
Opengraph URL: https://github.com/googleapis/python-pubsub/issues/825
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Can't reach GCP PubSub Emulator","articleBody":"I have setup the PubSub emulator to run a Python script locally pointing to it. \r\nThe emulator is run following the tutorial and it seems to be working fine: \r\n``` \r\n➜ gcloud beta emulators pubsub start --project=tokyo-rain-123 --host-port=127.0.0.1:8085\r\nExecuting: /Users/pabloruiz/Downloads/google-cloud-sdk/platform/pubsub-emulator/bin/cloud-pubsub-emulator --host=127.0.0.1 --port=8085\r\n[pubsub] This is the Google Pub/Sub fake.\r\n[pubsub] Implementation may be incomplete or differ from the real system.\r\n[pubsub] Nov 17, 2022 3:32:04 PM com.google.cloud.pubsub.testing.v1.Main main\r\n[pubsub] INFO: IAM integration is disabled. IAM policy methods and ACL checks are not supported\r\n[pubsub] SLF4J: Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".\r\n[pubsub] SLF4J: Defaulting to no-operation (NOP) logger implementation\r\n[pubsub] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.\r\n[pubsub] Nov 17, 2022 3:32:04 PM com.google.cloud.pubsub.testing.v1.Main main\r\n[pubsub] INFO: Server started, listening on 8085\r\n```\r\n\r\n**It is working fine using curl:**\r\n```\r\n➜ curl -X PUT http://localhost:8085/v1/projects/tokyo-rain-123/topics/topic-data1\r\n{\r\n \"name\": \"projects/tokyo-rain-123/topics/topic-data1\"\r\n}\r\n```\r\nAlthough it is displaying this warning on the emulator:\r\n```\r\n[pubsub] INFO: Server started, listening on 8085\r\n[pubsub] Nov 17, 2022 4:00:57 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\r\n[pubsub] INFO: Detected non-HTTP/2 connection.\r\n[pubsub] Nov 17, 2022 4:00:57 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead\r\n[pubsub] INFO: Detected HTTP/2 connection.\r\n```\r\n\r\nIf 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:\r\n\r\n```\r\nimport logging\r\nimport os\r\nfrom dotenv import load_dotenv\r\nfrom google.cloud import pubsub_v1\r\n\r\nload_dotenv()\r\nlogger = logging.getLogger(__name__)\r\n\r\nHOST, PROJECT_ID = os.environ.get(\"PUBSUB_EMULATOR_HOST\"), os.environ.get(\"PUBSUB_PROJECT_ID\")\r\nprint(f\"Host: {HOST}, Project ID: {PROJECT_ID}\")\r\n\r\npublisher = pubsub_v1.PublisherClient()\r\n\r\ndef list_topics(project_id):\r\n project_path = f\"projects/{project_id}\"\r\n all_topics = list(publisher.list_topics(\r\n request={\"project\": project_path},\r\n timeout=5\r\n ))\r\n print(f\"Found {len(all_topics)}\")\r\n return all_topics\r\n\r\n\r\nlogger.info(\"Listing topics for project:\")\r\ntopics = list_topics(project_id=PROJECT_ID)\r\nfor topic in topics:\r\n logger.info(topics)\r\n```\r\n\r\nwhich is just printing the correct env variables, but the client never gets a response for the rpc call. \r\n```\r\nHost: [::1]:8085, Project ID: tokyo-rain-123\r\n```\r\n\r\nAny idea why this is happening ?\r\n\r\nThanks in advance !","author":{"url":"https://github.com/PabloRR100","@type":"Person","name":"PabloRR100"},"datePublished":"2022-11-17T16:25:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/825/python-pubsub/issues/825"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:584a226e-767c-2910-7381-05470bbddfea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E75E:259068:E348E:138C00:6A4D0578 |
| html-safe-nonce | 08dd675cd92937c3678f5ae4c24aa97fd07a8d8d87ee5d34ab204fac2d999b9d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzVFOjI1OTA2ODpFMzQ4RToxMzhDMDA6NkE0RDA1NzgiLCJ2aXNpdG9yX2lkIjoiODA0MDIxMDczMDE1NzE0NzUxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7243d32e32f671e5a66dbb7ec9a0b1aa3cb321c8fcf465639c5fec483476cede |
| hovercard-subject-tag | issue:1453630812 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/python-pubsub/825/issue_layout |
| twitter:image | https://opengraph.githubassets.com/df5e9081fa98996f6987f95c4de10893410eff519cbe957c37039bc1756fdde6/googleapis/python-pubsub/issues/825 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/df5e9081fa98996f6987f95c4de10893410eff519cbe957c37039bc1756fdde6/googleapis/python-pubsub/issues/825 |
| og:image:alt | 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 --pr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | PabloRR100 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 31e4db13a9e20081f2fac78f441659a6576e582bbb15e153f9c7fb6473aa29f5 |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/python-pubsub git https://github.com/googleapis/python-pubsub.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 226992581 |
| octolytics-dimension-repository_nwo | googleapis/python-pubsub |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 226992581 |
| octolytics-dimension-repository_network_root_nwo | googleapis/python-pubsub |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fb70bd3c4b2bec429781b65419e912c66e2d5581 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width