diff --git a/src/adapters/http/client.ts b/src/adapters/http/client.ts index d8b35aefa..fe1aa1f24 100644 --- a/src/adapters/http/client.ts +++ b/src/adapters/http/client.ts @@ -20,7 +20,7 @@ class HttpClientAdapter extends Adapter { async send(message: GleeMessage): Promise { const headers = {} const config: HttpAdapterConfig = await this.resolveProtocolConfig('http') - const auth: HttpAuthConfig = await this.getAuthConfig(config.client.auth) + const auth: HttpAuthConfig = await this.getAuthConfig(config?.client?.auth) headers['Authentication'] = auth?.token const serverUrl = this.serverUrlExpanded for (const channelName of this.channelNames) { diff --git a/src/adapters/kafka/index.ts b/src/adapters/kafka/index.ts index c856a328a..27fd8f1d4 100644 --- a/src/adapters/kafka/index.ts +++ b/src/adapters/kafka/index.ts @@ -14,7 +14,7 @@ class KafkaAdapter extends Adapter { const kafkaOptions: KafkaAdapterConfig = await this.resolveProtocolConfig( 'kafka' ) - const auth: KafkaAuthConfig = await this.getAuthConfig(kafkaOptions.auth) + const auth: KafkaAuthConfig = await this.getAuthConfig(kafkaOptions?.auth) const securityRequirements = (this.AsyncAPIServer.security() || []).map( (sec) => { const secName = Object.keys(sec.json())[0] diff --git a/src/adapters/mqtt/index.ts b/src/adapters/mqtt/index.ts index 0cb42f1b1..379288646 100644 --- a/src/adapters/mqtt/index.ts +++ b/src/adapters/mqtt/index.ts @@ -152,7 +152,7 @@ class MqttAdapter extends Adapter { const mqttOptions: MqttAdapterConfig = await this.resolveProtocolConfig( 'mqtt' ) - const auth: MqttAuthConfig = await this.getAuthConfig(mqttOptions.auth) + const auth: MqttAuthConfig = await this.getAuthConfig(mqttOptions?.auth) const subscribedChannels = this.getSubscribedChannels() const mqttServerBinding = this.AsyncAPIServer.binding('mqtt') const mqtt5ServerBinding = this.AsyncAPIServer.binding('mqtt5') diff --git a/src/adapters/ws/client.ts b/src/adapters/ws/client.ts index 133927074..6dca108ee 100644 --- a/src/adapters/ws/client.ts +++ b/src/adapters/ws/client.ts @@ -32,7 +32,7 @@ class WsClientAdapter extends Adapter { const headers = {} const wsOptions: WebsocketAdapterConfig = await this.resolveProtocolConfig('ws') - const auth: WsAuthConfig = await this.getAuthConfig(wsOptions.client.auth) + const auth: WsAuthConfig = await this.getAuthConfig(wsOptions?.client?.auth) headers['Authentication'] = `bearer ${auth?.token}` const url = new URL(this.AsyncAPIServer.url() + channel)