@upstash/redis 1.34.2 → 1.34.3-canary

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,7 +19,7 @@ var UpstashError = class extends Error {
19
19
  var UrlError = class extends Error {
20
20
  constructor(url) {
21
21
  super(
22
- `Upstash Redis client was passed an invalid URL. You should pass the URL together with https. Received: "${url}". `
22
+ `Upstash Redis client was passed an invalid URL. You should pass a URL starting with https. Received: "${url}". `
23
23
  );
24
24
  this.name = "UrlError";
25
25
  }
@@ -32,6 +32,7 @@ var HttpClient = class {
32
32
  options;
33
33
  readYourWrites;
34
34
  upstashSyncToken = "";
35
+ hasCredentials;
35
36
  retry;
36
37
  constructor(config) {
37
38
  this.options = {
@@ -47,13 +48,14 @@ var HttpClient = class {
47
48
  this.readYourWrites = config.readYourWrites ?? true;
48
49
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
49
50
  const urlRegex = /^https?:\/\/[^\s#$./?].\S*$/;
50
- if (!urlRegex.test(this.baseUrl)) {
51
+ if (this.baseUrl && !urlRegex.test(this.baseUrl)) {
51
52
  throw new UrlError(this.baseUrl);
52
53
  }
53
54
  this.headers = {
54
55
  "Content-Type": "application/json",
55
56
  ...config.headers
56
57
  };
58
+ this.hasCredentials = Boolean(this.baseUrl && this.headers.authorization.split(" ")[1]);
57
59
  if (this.options.responseEncoding === "base64") {
58
60
  this.headers["Upstash-Encoding"] = "base64";
59
61
  }
@@ -85,6 +87,11 @@ var HttpClient = class {
85
87
  */
86
88
  backend: this.options.backend
87
89
  };
90
+ if (!this.hasCredentials) {
91
+ throw new Error(
92
+ "[Upstash Redis] Redis client was initialized without url or token. Failed to execute command."
93
+ );
94
+ }
88
95
  if (this.readYourWrites) {
89
96
  const newHeader = this.upstashSyncToken;
90
97
  this.headers["upstash-sync-token"] = newHeader;
@@ -3793,7 +3800,7 @@ var Redis = class {
3793
3800
  };
3794
3801
 
3795
3802
  // version.ts
3796
- var VERSION = "v1.34.2";
3803
+ var VERSION = "1.34.3-canary";
3797
3804
 
3798
3805
  export {
3799
3806
  error_exports,
package/cloudflare.js CHANGED
@@ -50,7 +50,7 @@ var UpstashError = class extends Error {
50
50
  var UrlError = class extends Error {
51
51
  constructor(url) {
52
52
  super(
53
- `Upstash Redis client was passed an invalid URL. You should pass the URL together with https. Received: "${url}". `
53
+ `Upstash Redis client was passed an invalid URL. You should pass a URL starting with https. Received: "${url}". `
54
54
  );
55
55
  this.name = "UrlError";
56
56
  }
@@ -63,6 +63,7 @@ var HttpClient = class {
63
63
  options;
64
64
  readYourWrites;
65
65
  upstashSyncToken = "";
66
+ hasCredentials;
66
67
  retry;
67
68
  constructor(config) {
68
69
  this.options = {
@@ -78,13 +79,14 @@ var HttpClient = class {
78
79
  this.readYourWrites = config.readYourWrites ?? true;
79
80
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
80
81
  const urlRegex = /^https?:\/\/[^\s#$./?].\S*$/;
81
- if (!urlRegex.test(this.baseUrl)) {
82
+ if (this.baseUrl && !urlRegex.test(this.baseUrl)) {
82
83
  throw new UrlError(this.baseUrl);
83
84
  }
84
85
  this.headers = {
85
86
  "Content-Type": "application/json",
86
87
  ...config.headers
87
88
  };
89
+ this.hasCredentials = Boolean(this.baseUrl && this.headers.authorization.split(" ")[1]);
88
90
  if (this.options.responseEncoding === "base64") {
89
91
  this.headers["Upstash-Encoding"] = "base64";
90
92
  }
@@ -116,6 +118,11 @@ var HttpClient = class {
116
118
  */
117
119
  backend: this.options.backend
118
120
  };
121
+ if (!this.hasCredentials) {
122
+ throw new Error(
123
+ "[Upstash Redis] Redis client was initialized without url or token. Failed to execute command."
124
+ );
125
+ }
119
126
  if (this.readYourWrites) {
120
127
  const newHeader = this.upstashSyncToken;
121
128
  this.headers["upstash-sync-token"] = newHeader;
@@ -3824,7 +3831,7 @@ var Redis = class {
3824
3831
  };
3825
3832
 
3826
3833
  // version.ts
3827
- var VERSION = "v1.34.2";
3834
+ var VERSION = "1.34.3-canary";
3828
3835
 
3829
3836
  // platforms/cloudflare.ts
3830
3837
  var Redis2 = class _Redis extends Redis {
@@ -3841,20 +3848,24 @@ var Redis2 = class _Redis extends Redis {
3841
3848
  */
3842
3849
  constructor(config, env) {
3843
3850
  if (!config.url) {
3844
- throw new Error(
3851
+ console.warn(
3845
3852
  `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
3846
3853
  );
3847
3854
  }
3848
3855
  if (!config.token) {
3849
- throw new Error(
3856
+ console.warn(
3850
3857
  `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
3851
3858
  );
3852
3859
  }
3853
3860
  if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
3854
- console.warn("The redis url contains whitespace or newline, which can cause errors!");
3861
+ console.warn(
3862
+ "[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
3863
+ );
3855
3864
  }
3856
3865
  if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
3857
- console.warn("The redis token contains whitespace or newline, which can cause errors!");
3866
+ console.warn(
3867
+ "[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
3868
+ );
3858
3869
  }
3859
3870
  const client = new HttpClient({
3860
3871
  retry: config.retry,
@@ -3894,13 +3905,13 @@ var Redis2 = class _Redis extends Redis {
3894
3905
  const url = env?.UPSTASH_REDIS_REST_URL ?? UPSTASH_REDIS_REST_URL;
3895
3906
  const token = env?.UPSTASH_REDIS_REST_TOKEN ?? UPSTASH_REDIS_REST_TOKEN;
3896
3907
  if (!url) {
3897
- throw new Error(
3898
- "Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`"
3908
+ console.warn(
3909
+ "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`"
3899
3910
  );
3900
3911
  }
3901
3912
  if (!token) {
3902
- throw new Error(
3903
- "Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`"
3913
+ console.warn(
3914
+ "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`"
3904
3915
  );
3905
3916
  }
3906
3917
  return new _Redis({ ...opts, url, token }, env);
package/cloudflare.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-3XV7NWGI.mjs";
6
+ } from "./chunk-FC2CKVKB.mjs";
7
7
 
8
8
  // platforms/cloudflare.ts
9
9
  var Redis2 = class _Redis extends Redis {
@@ -20,20 +20,24 @@ var Redis2 = class _Redis extends Redis {
20
20
  */
21
21
  constructor(config, env) {
22
22
  if (!config.url) {
23
- throw new Error(
23
+ console.warn(
24
24
  `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
25
25
  );
26
26
  }
27
27
  if (!config.token) {
28
- throw new Error(
28
+ console.warn(
29
29
  `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
30
30
  );
31
31
  }
32
32
  if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
33
- console.warn("The redis url contains whitespace or newline, which can cause errors!");
33
+ console.warn(
34
+ "[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
35
+ );
34
36
  }
35
37
  if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
36
- console.warn("The redis token contains whitespace or newline, which can cause errors!");
38
+ console.warn(
39
+ "[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
40
+ );
37
41
  }
38
42
  const client = new HttpClient({
39
43
  retry: config.retry,
@@ -73,13 +77,13 @@ var Redis2 = class _Redis extends Redis {
73
77
  const url = env?.UPSTASH_REDIS_REST_URL ?? UPSTASH_REDIS_REST_URL;
74
78
  const token = env?.UPSTASH_REDIS_REST_TOKEN ?? UPSTASH_REDIS_REST_TOKEN;
75
79
  if (!url) {
76
- throw new Error(
77
- "Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`"
80
+ console.warn(
81
+ "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_URL`"
78
82
  );
79
83
  }
80
84
  if (!token) {
81
- throw new Error(
82
- "Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`"
85
+ console.warn(
86
+ "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`. Please add it via `wrangler secret put UPSTASH_REDIS_REST_TOKEN`"
83
87
  );
84
88
  }
85
89
  return new _Redis({ ...opts, url, token }, env);
package/fastly.js CHANGED
@@ -50,7 +50,7 @@ var UpstashError = class extends Error {
50
50
  var UrlError = class extends Error {
51
51
  constructor(url) {
52
52
  super(
53
- `Upstash Redis client was passed an invalid URL. You should pass the URL together with https. Received: "${url}". `
53
+ `Upstash Redis client was passed an invalid URL. You should pass a URL starting with https. Received: "${url}". `
54
54
  );
55
55
  this.name = "UrlError";
56
56
  }
@@ -63,6 +63,7 @@ var HttpClient = class {
63
63
  options;
64
64
  readYourWrites;
65
65
  upstashSyncToken = "";
66
+ hasCredentials;
66
67
  retry;
67
68
  constructor(config) {
68
69
  this.options = {
@@ -78,13 +79,14 @@ var HttpClient = class {
78
79
  this.readYourWrites = config.readYourWrites ?? true;
79
80
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
80
81
  const urlRegex = /^https?:\/\/[^\s#$./?].\S*$/;
81
- if (!urlRegex.test(this.baseUrl)) {
82
+ if (this.baseUrl && !urlRegex.test(this.baseUrl)) {
82
83
  throw new UrlError(this.baseUrl);
83
84
  }
84
85
  this.headers = {
85
86
  "Content-Type": "application/json",
86
87
  ...config.headers
87
88
  };
89
+ this.hasCredentials = Boolean(this.baseUrl && this.headers.authorization.split(" ")[1]);
88
90
  if (this.options.responseEncoding === "base64") {
89
91
  this.headers["Upstash-Encoding"] = "base64";
90
92
  }
@@ -116,6 +118,11 @@ var HttpClient = class {
116
118
  */
117
119
  backend: this.options.backend
118
120
  };
121
+ if (!this.hasCredentials) {
122
+ throw new Error(
123
+ "[Upstash Redis] Redis client was initialized without url or token. Failed to execute command."
124
+ );
125
+ }
119
126
  if (this.readYourWrites) {
120
127
  const newHeader = this.upstashSyncToken;
121
128
  this.headers["upstash-sync-token"] = newHeader;
@@ -3824,7 +3831,7 @@ var Redis = class {
3824
3831
  };
3825
3832
 
3826
3833
  // version.ts
3827
- var VERSION = "v1.34.2";
3834
+ var VERSION = "1.34.3-canary";
3828
3835
 
3829
3836
  // platforms/fastly.ts
3830
3837
  var Redis2 = class extends Redis {
@@ -3842,20 +3849,24 @@ var Redis2 = class extends Redis {
3842
3849
  */
3843
3850
  constructor(config) {
3844
3851
  if (!config.url) {
3845
- throw new Error(
3852
+ console.warn(
3846
3853
  `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
3847
3854
  );
3848
3855
  }
3849
3856
  if (!config.token) {
3850
- throw new Error(
3857
+ console.warn(
3851
3858
  `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
3852
3859
  );
3853
3860
  }
3854
3861
  if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
3855
- console.warn("The redis url contains whitespace or newline, which can cause errors!");
3862
+ console.warn(
3863
+ "[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
3864
+ );
3856
3865
  }
3857
3866
  if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
3858
- console.warn("The redis token contains whitespace or newline, which can cause errors!");
3867
+ console.warn(
3868
+ "[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
3869
+ );
3859
3870
  }
3860
3871
  const client = new HttpClient({
3861
3872
  baseUrl: config.url,
package/fastly.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-3XV7NWGI.mjs";
6
+ } from "./chunk-FC2CKVKB.mjs";
7
7
 
8
8
  // platforms/fastly.ts
9
9
  var Redis2 = class extends Redis {
@@ -21,20 +21,24 @@ var Redis2 = class extends Redis {
21
21
  */
22
22
  constructor(config) {
23
23
  if (!config.url) {
24
- throw new Error(
24
+ console.warn(
25
25
  `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
26
26
  );
27
27
  }
28
28
  if (!config.token) {
29
- throw new Error(
29
+ console.warn(
30
30
  `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
31
31
  );
32
32
  }
33
33
  if (config.url.startsWith(" ") || config.url.endsWith(" ") || /\r|\n/.test(config.url)) {
34
- console.warn("The redis url contains whitespace or newline, which can cause errors!");
34
+ console.warn(
35
+ "[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
36
+ );
35
37
  }
36
38
  if (config.token.startsWith(" ") || config.token.endsWith(" ") || /\r|\n/.test(config.token)) {
37
- console.warn("The redis token contains whitespace or newline, which can cause errors!");
39
+ console.warn(
40
+ "[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
41
+ );
38
42
  }
39
43
  const client = new HttpClient({
40
44
  baseUrl: config.url,
package/nodejs.js CHANGED
@@ -50,7 +50,7 @@ var UpstashError = class extends Error {
50
50
  var UrlError = class extends Error {
51
51
  constructor(url) {
52
52
  super(
53
- `Upstash Redis client was passed an invalid URL. You should pass the URL together with https. Received: "${url}". `
53
+ `Upstash Redis client was passed an invalid URL. You should pass a URL starting with https. Received: "${url}". `
54
54
  );
55
55
  this.name = "UrlError";
56
56
  }
@@ -63,6 +63,7 @@ var HttpClient = class {
63
63
  options;
64
64
  readYourWrites;
65
65
  upstashSyncToken = "";
66
+ hasCredentials;
66
67
  retry;
67
68
  constructor(config) {
68
69
  this.options = {
@@ -78,13 +79,14 @@ var HttpClient = class {
78
79
  this.readYourWrites = config.readYourWrites ?? true;
79
80
  this.baseUrl = config.baseUrl.replace(/\/$/, "");
80
81
  const urlRegex = /^https?:\/\/[^\s#$./?].\S*$/;
81
- if (!urlRegex.test(this.baseUrl)) {
82
+ if (this.baseUrl && !urlRegex.test(this.baseUrl)) {
82
83
  throw new UrlError(this.baseUrl);
83
84
  }
84
85
  this.headers = {
85
86
  "Content-Type": "application/json",
86
87
  ...config.headers
87
88
  };
89
+ this.hasCredentials = Boolean(this.baseUrl && this.headers.authorization.split(" ")[1]);
88
90
  if (this.options.responseEncoding === "base64") {
89
91
  this.headers["Upstash-Encoding"] = "base64";
90
92
  }
@@ -116,6 +118,11 @@ var HttpClient = class {
116
118
  */
117
119
  backend: this.options.backend
118
120
  };
121
+ if (!this.hasCredentials) {
122
+ throw new Error(
123
+ "[Upstash Redis] Redis client was initialized without url or token. Failed to execute command."
124
+ );
125
+ }
119
126
  if (this.readYourWrites) {
120
127
  const newHeader = this.upstashSyncToken;
121
128
  this.headers["upstash-sync-token"] = newHeader;
@@ -3824,7 +3831,7 @@ var Redis = class {
3824
3831
  };
3825
3832
 
3826
3833
  // version.ts
3827
- var VERSION = "v1.34.2";
3834
+ var VERSION = "1.34.3-canary";
3828
3835
 
3829
3836
  // platforms/nodejs.ts
3830
3837
  if (typeof atob === "undefined") {
@@ -3854,26 +3861,29 @@ var Redis2 = class _Redis extends Redis {
3854
3861
  return;
3855
3862
  }
3856
3863
  if (!configOrRequester.url) {
3857
- throw new Error(
3864
+ console.warn(
3858
3865
  `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
3859
3866
  );
3860
3867
  }
3861
3868
  if (!configOrRequester.token) {
3862
- throw new Error(
3869
+ console.warn(
3863
3870
  `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
3864
3871
  );
3865
3872
  }
3866
3873
  if (configOrRequester.url.startsWith(" ") || configOrRequester.url.endsWith(" ") || /\r|\n/.test(configOrRequester.url)) {
3867
- console.warn("The redis url contains whitespace or newline, which can cause errors!");
3874
+ console.warn(
3875
+ "[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
3876
+ );
3868
3877
  }
3869
3878
  if (configOrRequester.token.startsWith(" ") || configOrRequester.token.endsWith(" ") || /\r|\n/.test(configOrRequester.token)) {
3870
- console.warn("The redis token contains whitespace or newline, which can cause errors!");
3879
+ console.warn(
3880
+ "[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
3881
+ );
3871
3882
  }
3872
3883
  const client = new HttpClient({
3873
3884
  baseUrl: configOrRequester.url,
3874
3885
  retry: configOrRequester.retry,
3875
3886
  headers: { authorization: `Bearer ${configOrRequester.token}` },
3876
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
3877
3887
  agent: configOrRequester.agent,
3878
3888
  responseEncoding: configOrRequester.responseEncoding,
3879
3889
  cache: configOrRequester.cache ?? "no-store",
@@ -3911,16 +3921,18 @@ var Redis2 = class _Redis extends Redis {
3911
3921
  static fromEnv(config) {
3912
3922
  if (process.env === void 0) {
3913
3923
  throw new TypeError(
3914
- 'Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
3924
+ '[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
3915
3925
  );
3916
3926
  }
3917
3927
  const url = process.env.UPSTASH_REDIS_REST_URL;
3918
3928
  if (!url) {
3919
- throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
3929
+ console.warn("[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
3920
3930
  }
3921
3931
  const token = process.env.UPSTASH_REDIS_REST_TOKEN;
3922
3932
  if (!token) {
3923
- throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`");
3933
+ console.warn(
3934
+ "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`"
3935
+ );
3924
3936
  }
3925
3937
  return new _Redis({ ...config, url, token });
3926
3938
  }
package/nodejs.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Redis,
4
4
  VERSION,
5
5
  error_exports
6
- } from "./chunk-3XV7NWGI.mjs";
6
+ } from "./chunk-FC2CKVKB.mjs";
7
7
 
8
8
  // platforms/nodejs.ts
9
9
  if (typeof atob === "undefined") {
@@ -33,26 +33,29 @@ var Redis2 = class _Redis extends Redis {
33
33
  return;
34
34
  }
35
35
  if (!configOrRequester.url) {
36
- throw new Error(
36
+ console.warn(
37
37
  `[Upstash Redis] The 'url' property is missing or undefined in your Redis config.`
38
38
  );
39
39
  }
40
40
  if (!configOrRequester.token) {
41
- throw new Error(
41
+ console.warn(
42
42
  `[Upstash Redis] The 'token' property is missing or undefined in your Redis config.`
43
43
  );
44
44
  }
45
45
  if (configOrRequester.url.startsWith(" ") || configOrRequester.url.endsWith(" ") || /\r|\n/.test(configOrRequester.url)) {
46
- console.warn("The redis url contains whitespace or newline, which can cause errors!");
46
+ console.warn(
47
+ "[Upstash Redis] The redis url contains whitespace or newline, which can cause errors!"
48
+ );
47
49
  }
48
50
  if (configOrRequester.token.startsWith(" ") || configOrRequester.token.endsWith(" ") || /\r|\n/.test(configOrRequester.token)) {
49
- console.warn("The redis token contains whitespace or newline, which can cause errors!");
51
+ console.warn(
52
+ "[Upstash Redis] The redis token contains whitespace or newline, which can cause errors!"
53
+ );
50
54
  }
51
55
  const client = new HttpClient({
52
56
  baseUrl: configOrRequester.url,
53
57
  retry: configOrRequester.retry,
54
58
  headers: { authorization: `Bearer ${configOrRequester.token}` },
55
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
56
59
  agent: configOrRequester.agent,
57
60
  responseEncoding: configOrRequester.responseEncoding,
58
61
  cache: configOrRequester.cache ?? "no-store",
@@ -90,16 +93,18 @@ var Redis2 = class _Redis extends Redis {
90
93
  static fromEnv(config) {
91
94
  if (process.env === void 0) {
92
95
  throw new TypeError(
93
- 'Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
96
+ '[Upstash Redis] Unable to get environment variables, `process.env` is undefined. If you are deploying to cloudflare, please import from "@upstash/redis/cloudflare" instead'
94
97
  );
95
98
  }
96
99
  const url = process.env.UPSTASH_REDIS_REST_URL;
97
100
  if (!url) {
98
- throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
101
+ console.warn("[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_URL`");
99
102
  }
100
103
  const token = process.env.UPSTASH_REDIS_REST_TOKEN;
101
104
  if (!token) {
102
- throw new Error("Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`");
105
+ console.warn(
106
+ "[Upstash Redis] Unable to find environment variable: `UPSTASH_REDIS_REST_TOKEN`"
107
+ );
103
108
  }
104
109
  return new _Redis({ ...config, url, token });
105
110
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@upstash/redis","version":"v1.34.2","main":"./nodejs.js","module":"./nodejs.mjs","types":"./nodejs.d.ts","exports":{".":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./node":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.js":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.mjs":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./fastly":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.js":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.mjs":{"import":"./fastly.mjs","require":"./fastly.js"}},"description":"An HTTP/REST based Redis client built on top of Upstash REST API.","repository":{"type":"git","url":"git+https://github.com/upstash/upstash-redis.git"},"keywords":["redis","database","serverless","edge","upstash"],"files":["./*"],"scripts":{"build":"tsup && cp package.json README.md LICENSE dist/","test":"bun test pkg","fmt":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","lint":"eslint \"**/*.{js,ts,tsx}\" --quiet --fix","format":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","format:check":"prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"","lint:fix":"eslint . -c .ts,.tsx,.js,.jsx --fix","commit":"cz","lint:format":"bun run lint:fix && bun run format","check-exports":"bun run build && cd dist && attw -P"},"author":"Andreas Thomas <dev@chronark.com>","license":"MIT","bugs":{"url":"https://github.com/upstash/upstash-redis/issues"},"homepage":"https://github.com/upstash/upstash-redis#readme","devDependencies":{"@biomejs/biome":"latest","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@types/crypto-js":"^4.1.3","@typescript-eslint/eslint-plugin":"8.4.0","@typescript-eslint/parser":"8.4.0","bun-types":"1.0.33","eslint":"9.10.0","eslint-plugin-unicorn":"55.0.0","husky":"^9.1.1","prettier":"^3.3.3","tsup":"^8.2.3","typescript":"latest"},"dependencies":{"crypto-js":"^4.2.0"}}
1
+ {"name":"@upstash/redis","version":"1.34.3-canary","main":"./nodejs.js","module":"./nodejs.mjs","types":"./nodejs.d.ts","exports":{".":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./node":{"import":"./nodejs.mjs","require":"./nodejs.js"},"./cloudflare":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.js":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./cloudflare.mjs":{"import":"./cloudflare.mjs","require":"./cloudflare.js"},"./fastly":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.js":{"import":"./fastly.mjs","require":"./fastly.js"},"./fastly.mjs":{"import":"./fastly.mjs","require":"./fastly.js"}},"description":"An HTTP/REST based Redis client built on top of Upstash REST API.","repository":{"type":"git","url":"git+https://github.com/upstash/upstash-redis.git"},"keywords":["redis","database","serverless","edge","upstash"],"files":["./*"],"scripts":{"build":"tsup && cp package.json README.md LICENSE dist/","test":"bun test pkg","fmt":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","lint":"eslint \"**/*.{js,ts,tsx}\" --quiet --fix","format":"prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"","format:check":"prettier --check \"**/*.{ts,tsx,js,jsx,json,md}\"","lint:fix":"eslint . -c .ts,.tsx,.js,.jsx --fix","commit":"cz","lint:format":"bun run lint:fix && bun run format","check-exports":"bun run build && cd dist && attw -P"},"author":"Andreas Thomas <dev@chronark.com>","license":"MIT","bugs":{"url":"https://github.com/upstash/upstash-redis/issues"},"homepage":"https://github.com/upstash/upstash-redis#readme","devDependencies":{"@biomejs/biome":"latest","@commitlint/cli":"^19.3.0","@commitlint/config-conventional":"^19.2.2","@types/crypto-js":"^4.1.3","@typescript-eslint/eslint-plugin":"8.4.0","@typescript-eslint/parser":"8.4.0","bun-types":"1.0.33","eslint":"9.10.0","eslint-plugin-unicorn":"55.0.0","husky":"^9.1.1","prettier":"^3.3.3","tsup":"^8.2.3","typescript":"latest"},"dependencies":{"crypto-js":"^4.2.0"}}