@opennextjs/cloudflare 1.19.9 → 1.19.10
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.
|
@@ -261,6 +261,18 @@ async function sendEntryToR2Worker(options) {
|
|
|
261
261
|
headers: {
|
|
262
262
|
"x-opennext-cache-key": key,
|
|
263
263
|
"content-length": fs.statSync(filename).size.toString(),
|
|
264
|
+
// Include Access Client ID and Secret if they are set in the environment,
|
|
265
|
+
// to allow the worker to authenticate with the Cloudflare API when writing to R2.
|
|
266
|
+
//
|
|
267
|
+
// The Application at "open-next-cache-populate.<account>.workers.dev" should have a policy with:
|
|
268
|
+
// - "Action" set to "Service Auth"
|
|
269
|
+
// - "Any Access Service Token" or "Service Token" + a specific service token
|
|
270
|
+
...(process.env.CLOUDFLARE_ACCESS_CLIENT_ID && process.env.CLOUDFLARE_ACCESS_CLIENT_SECRET
|
|
271
|
+
? {
|
|
272
|
+
"CF-Access-Client-Id": process.env.CLOUDFLARE_ACCESS_CLIENT_ID,
|
|
273
|
+
"CF-Access-Client-Secret": process.env.CLOUDFLARE_ACCESS_CLIENT_SECRET,
|
|
274
|
+
}
|
|
275
|
+
: {}),
|
|
264
276
|
},
|
|
265
277
|
body: Readable.toWeb(fs.createReadStream(filename)),
|
|
266
278
|
signal: AbortSignal.timeout(60_000),
|