Skip to content

Commit

Permalink
Check for client side token for nextjs
Browse files Browse the repository at this point in the history
  • Loading branch information
ogzhanolguncu committed Jan 18, 2024
1 parent 8df9170 commit ae4432c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,17 @@ export class Index extends core.Index {
super(configOrRequester);
return;
}
const token = process.env.UPSTASH_VECTOR_TOKEN ?? configOrRequester?.token;
const url = process.env.UPSTASH_VECTOR_REST_URL ?? configOrRequester?.url;
const token =
process.env.NEXT_PUBLIC_UPSTASH_VECTOR_REST_TOKEN ??
process.env.UPSTASH_VECTOR_REST_TOKEN ??
configOrRequester?.token;
const url =
process.env.NEXT_PUBLIC_UPSTASH_VECTOR_REST_URL ??
process.env.UPSTASH_VECTOR_REST_URL ??
configOrRequester?.url;

if (!token) {
throw new Error("UPSTASH_VECTOR_TOKEN is missing!");
throw new Error("UPSTASH_VECTOR_REST_TOKEN is missing!");
}
if (!url) {
throw new Error("UPSTASH_VECTOR_REST_URL is missing!");
Expand Down

0 comments on commit ae4432c

Please sign in to comment.