Skip to content

Commit afef475

Browse files
committed
Fix passing auth in changes
1 parent 433d48e commit afef475

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/connection/helpers.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function connectToWeaviateCloud(
8686
grpcHost = `grpc-${url.hostname}`;
8787
}
8888

89-
const { authCredentials, headers, ...rest } = options || {};
89+
const { authCredentials: auth, headers, ...rest } = options || {};
9090

9191
return clientMaker({
9292
connectionParams: {
@@ -101,8 +101,8 @@ export function connectToWeaviateCloud(
101101
port: 443,
102102
},
103103
},
104-
auth: authCredentials,
105-
headers: addWeaviateEmbeddingServiceHeaders(clusterURL, authCredentials, headers),
104+
auth,
105+
headers: addWeaviateEmbeddingServiceHeaders(clusterURL, auth, headers),
106106
...rest,
107107
}).catch((e) => {
108108
throw new WeaviateStartUpError(`Weaviate failed to startup with message: ${e.message}`);
@@ -113,7 +113,7 @@ export function connectToLocal(
113113
clientMaker: (params: ClientParams) => Promise<WeaviateClient>,
114114
options?: ConnectToLocalOptions
115115
): Promise<WeaviateClient> {
116-
const { host, port, grpcPort, ...rest } = options || {};
116+
const { host, port, grpcPort, authCredentials: auth, ...rest } = options || {};
117117
return clientMaker({
118118
connectionParams: {
119119
http: {
@@ -127,6 +127,7 @@ export function connectToLocal(
127127
port: grpcPort || 50051,
128128
},
129129
},
130+
auth,
130131
...rest,
131132
}).catch((e) => {
132133
throw new WeaviateStartUpError(`Weaviate failed to startup with message: ${e.message}`);
@@ -137,7 +138,17 @@ export function connectToCustom(
137138
clientMaker: (params: ClientParams) => Promise<WeaviateClient>,
138139
options?: ConnectToCustomOptions
139140
): Promise<WeaviateClient> {
140-
const { httpHost, httpPath, httpPort, httpSecure, grpcHost, grpcPort, grpcSecure, ...rest } = options || {};
141+
const {
142+
httpHost,
143+
httpPath,
144+
httpPort,
145+
httpSecure,
146+
grpcHost,
147+
grpcPort,
148+
grpcSecure,
149+
authCredentials: auth,
150+
...rest
151+
} = options || {};
141152
return clientMaker({
142153
connectionParams: {
143154
http: {
@@ -152,6 +163,7 @@ export function connectToCustom(
152163
port: grpcPort || 50051,
153164
},
154165
},
166+
auth,
155167
...rest,
156168
}).catch((e) => {
157169
throw new WeaviateStartUpError(`Weaviate failed to startup with message: ${e.message}`);

0 commit comments

Comments
 (0)