https://github.com/emartech/pub-sub-deadline-exceeded-repro
Reproduction of Pub/Sub DEADLINE_EXCEEDED error in Node.js.
https://github.com/emartech/pub-sub-deadline-exceeded-repro
Last synced: over 1 year ago
JSON representation
Reproduction of Pub/Sub DEADLINE_EXCEEDED error in Node.js.
- Host: GitHub
- URL: https://github.com/emartech/pub-sub-deadline-exceeded-repro
- Owner: emartech
- Created: 2024-02-07T09:58:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-07T13:39:51.000Z (over 2 years ago)
- Last Synced: 2025-02-09T18:35:48.142Z (over 1 year ago)
- Language: JavaScript
- Size: 19.5 KB
- Stars: 1
- Watchers: 8
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Pub/Sub DEADLINE_EXCEEDED Error Reproduction
## Overview
This repository contains a reproduction of the `DEADLINE_EXCEEDED` error that
occurs when using the `@google-cloud/pubsub` library in Node.js to consume
messages from a Pub/Sub subscription using the `v1.SubscriberClient` API.
Note that the `DEADLINE_EXCEEDED` **error does not occur** when using the
latest Subscriber from this library. This repository contains both a v1 and
latest version of the Subscriber to demonstrate this difference.
## Run
### Configure
```sh
# Install Node.js and dependencies
nvm install
npm install
# Configure environment
cp .env.example .env
vim .env
set -a; source .env; set +a
# Create Pub/Sub topic and subscription
gcloud pubsub topics create $PUB_SUB_TOPIC_ID --project $GOOGLE_CLOUD_PROJECT
gcloud pubsub subscriptions create $PUB_SUB_SUBSCRIPTION_ID --topic $PUB_SUB_TOPIC_ID
```
### v1 PublisherClient and SubscriberClient
Start the publisher and subscriber in separate terminals, and **wait 15 minutes**
for the `DEADLINE_EXCEEDED` error to occur in the subscriber.
```sh
npm run v1-publisher
npm run v1-subscriber
```
### Latest Publisher and Subscriber
Start the publisher and subscriber in separate terminals, and wait 15 minutes.
The `DEADLINE_EXCEEDED` **error does not occur** in the subscriber.
```sh
npm run publisher
npm run subscriber
```
## Cleanup
```sh
gcloud pubsub subscriptions delete $PUB_SUB_SUBSCRIPTION_ID --project $GOOGLE_CLOUD_PROJECT
gcloud pubsub topics delete $PUB_SUB_TOPIC_ID --project $GOOGLE_CLOUD_PROJECT
```
## GitHub Issue
There was a [GitHub issue](https://github.com/googleapis/nodejs-pubsub/issues/1135) opened for
this problem in the official repository of the Pub/Sub Node.js library, but it was closed without
resolving the problem.