Skip to content

Commit 983a89f

Browse files
return null in kvCache get method
1 parent fe96df4 commit 983a89f

File tree

4 files changed

+45
-51
lines changed

4 files changed

+45
-51
lines changed

.changeset/fluffy-taxis-rescue.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
bump `@opennextjs/aws` dependency to `https://pkg.pr.new/@opennextjs/aws@726`

packages/cloudflare/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"dependencies": {
7474
"@ast-grep/napi": "^0.34.1",
7575
"@dotenvx/dotenvx": "catalog:",
76-
"@opennextjs/aws": "https://pkg.pr.new/@opennextjs/aws@724",
76+
"@opennextjs/aws": "https://pkg.pr.new/@opennextjs/aws@726",
7777
"enquirer": "^2.4.1",
7878
"glob": "catalog:",
7979
"ts-morph": "catalog:",

packages/cloudflare/src/api/kvCache.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Cache implements IncrementalCache {
3737
async get<IsFetch extends boolean = false>(
3838
key: string,
3939
isFetch?: IsFetch
40-
): Promise<WithLastModified<CacheValue<IsFetch>>> {
40+
): Promise<WithLastModified<CacheValue<IsFetch>> | null> {
4141
const cfEnv = getCloudflareContext().env;
4242
const kv = cfEnv.NEXT_CACHE_WORKERS_KV;
4343
const assets = cfEnv.ASSETS;
@@ -60,7 +60,7 @@ class Cache implements IncrementalCache {
6060
const kvKey = this.getKVKey(key, isFetch);
6161
entry = await kv.get(kvKey, "json");
6262
if (entry?.status === STATUS_DELETED) {
63-
return {};
63+
return null;
6464
}
6565
}
6666

@@ -86,7 +86,7 @@ class Cache implements IncrementalCache {
8686
const expiresTime = new Date(expires as string).getTime();
8787
if (!isNaN(expiresTime) && expiresTime <= Date.now()) {
8888
this.debug(`found expired entry (expire time: ${expires})`);
89-
return {};
89+
return null;
9090
}
9191
}
9292

0 commit comments

Comments
 (0)