Skip to content

Commit f983fc0

Browse files
committed
🐛 Fix no PUBSUB_CONTACTS_CHANGED_TOPIC_NAME provided
1 parent 84e502a commit f983fc0

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/models/controller.model.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,13 @@ export class Controller {
7070
if (this.adapter.streamContacts) {
7171
const {
7272
PUBSUB_TOPIC_NAME: topicName,
73-
PUBSUB_CONTACTS_CHANGED_TOPIC_NAME: contactsChangedTopicName,
7473
INTEGRATION_NAME: integrationName,
7574
} = process.env;
7675

7776
if (!topicName) {
7877
throw new Error('No PUBSUB_TOPIC_NAME provided.');
7978
}
8079

81-
if (!contactsChangedTopicName) {
82-
throw new Error('No PUBSUB_CONTACTS_CHANGED_TOPIC_NAME provided.');
83-
}
84-
8580
if (!integrationName) {
8681
throw new Error('No INTEGRATION_NAME provided.');
8782
}
@@ -92,6 +87,22 @@ export class Controller {
9287
'Controller',
9388
`Initialized PubSub client with topic ${topicName}`,
9489
);
90+
}
91+
92+
if (this.adapter.handleWebhook) {
93+
const {
94+
PUBSUB_CONTACTS_CHANGED_TOPIC_NAME: contactsChangedTopicName,
95+
INTEGRATION_NAME: integrationName,
96+
} = process.env;
97+
98+
if (!contactsChangedTopicName) {
99+
throw new Error('No PUBSUB_CONTACTS_CHANGED_TOPIC_NAME provided.');
100+
}
101+
102+
if (!integrationName) {
103+
throw new Error('No INTEGRATION_NAME provided.');
104+
}
105+
this.integrationName = integrationName;
95106

96107
this.pubSubContactsChangedClient = new PubSubContactChangeEventClient(
97108
contactsChangedTopicName,

0 commit comments

Comments
 (0)