File tree Expand file tree Collapse file tree 1 file changed +9
-11
lines changed
packages/cloudflare/src/api Expand file tree Collapse file tree 1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change 1- import type {
2- CachedFetchValue ,
3- CacheValue ,
4- IncrementalCache ,
5- WithLastModified ,
6- } from "@opennextjs/aws/types/overrides" ;
1+ import type { CacheValue , IncrementalCache , WithLastModified } from "@opennextjs/aws/types/overrides" ;
72import { IgnorableError , RecoverableError } from "@opennextjs/aws/utils/error.js" ;
83
94import { getCloudflareContext } from "./cloudflare-context.js" ;
@@ -70,12 +65,15 @@ class Cache implements IncrementalCache {
7065 // The cache can not be updated when there is no KV
7166 // As we don't want to keep serving stale data for ever,
7267 // we pretend the entry is not in cache
73- const entryValue = entry ?. value as CachedFetchValue ;
74- if ( entryValue ?. kind === "FETCH" ) {
75- const expires = entryValue . data . headers ?. expires ;
76- const expiresTime = new Date ( expires as string ) . getTime ( ) ;
68+ if (
69+ entry ?. value &&
70+ "kind" in entry . value &&
71+ entry . value . kind === "FETCH" &&
72+ entry . value . data ?. headers ?. expires
73+ ) {
74+ const expiresTime = new Date ( entry . value . data . headers . expires ) . getTime ( ) ;
7775 if ( ! isNaN ( expiresTime ) && expiresTime <= Date . now ( ) ) {
78- this . debug ( `found expired entry (expire time: ${ expires } )` ) ;
76+ this . debug ( `found expired entry (expire time: ${ entry . value . data . headers . expires } )` ) ;
7977 return null ;
8078 }
8179 }
You can’t perform that action at this time.
0 commit comments