@@ -100,6 +100,8 @@ async function populateR2IncrementalCache(
100100
101101 const config = unstable_readConfig ( { env : populateCacheOptions . environment } ) ;
102102 const proxy = await getPlatformProxy < CloudflareEnv > ( populateCacheOptions ) ;
103+ const prefix = proxy . env [ R2_CACHE_PREFIX_ENV_NAME ] ; // Set the cache type to R2 for the current environment
104+ await proxy . dispose ( ) ;
103105
104106 const binding = config . r2_buckets . find ( ( { binding } ) => binding === R2_CACHE_BINDING_NAME ) ;
105107 if ( ! binding ) {
@@ -115,7 +117,7 @@ async function populateR2IncrementalCache(
115117
116118 for ( const { fullPath, key, buildId, isFetch } of tqdm ( assets ) ) {
117119 const cacheKey = computeCacheKey ( key , {
118- prefix : proxy . env [ R2_CACHE_PREFIX_ENV_NAME ] ,
120+ prefix,
119121 buildId,
120122 cacheType : isFetch ? "fetch" : "cache" ,
121123 } ) ;
@@ -139,6 +141,8 @@ async function populateKVIncrementalCache(
139141
140142 const config = unstable_readConfig ( { env : populateCacheOptions . environment } ) ;
141143 const proxy = await getPlatformProxy < CloudflareEnv > ( populateCacheOptions ) ;
144+ const prefix = proxy . env [ KV_CACHE_PREFIX_ENV_NAME ] ;
145+ await proxy . dispose ( ) ;
142146
143147 const binding = config . kv_namespaces . find ( ( { binding } ) => binding === KV_CACHE_BINDING_NAME ) ;
144148 if ( ! binding ) {
@@ -159,7 +163,7 @@ async function populateKVIncrementalCache(
159163 . slice ( i * chunkSize , ( i + 1 ) * chunkSize )
160164 . map ( ( { fullPath, key, buildId, isFetch } ) => ( {
161165 key : computeCacheKey ( key , {
162- prefix : proxy . env [ KV_CACHE_PREFIX_ENV_NAME ] ,
166+ prefix,
163167 buildId,
164168 cacheType : isFetch ? "fetch" : "cache" ,
165169 } ) ,
0 commit comments