@netlify/plugin-nextjs
Advanced tools
Comparing version
@@ -14,2 +14,3 @@ | ||
import { PLUGIN_DIR, RUN_CONFIG } from "./constants.js"; | ||
import { setInMemoryCacheMaxSizeFromNextConfig } from "./storage/storage.cjs"; | ||
var getRunConfig = async () => { | ||
@@ -25,8 +26,9 @@ return JSON.parse(await readFile(resolve(PLUGIN_DIR, RUN_CONFIG), "utf-8")); | ||
...config.experimental, | ||
// @ts-expect-error incrementalCacheHandlerPath was removed from config type | ||
// but we still need to set it for older Next.js versions | ||
// Before Next.js 14.1.0 path to the cache handler was in experimental section, see NextConfigForMultipleVersions type | ||
incrementalCacheHandlerPath: cacheHandler | ||
}; | ||
config.cacheHandler = cacheHandler; | ||
config.cacheMaxMemorySize = 0; | ||
setInMemoryCacheMaxSizeFromNextConfig( | ||
config.cacheMaxMemorySize ?? config.experimental?.isrMemoryCacheSize | ||
); | ||
process.env.__NEXT_PRIVATE_STANDALONE_CONFIG = JSON.stringify(config); | ||
@@ -33,0 +35,0 @@ }; |
@@ -10,5 +10,5 @@ | ||
// src/run/headers.ts | ||
import { encodeBlobKey } from "../shared/blobkey.js"; | ||
import { getLogger } from "./handlers/request-context.cjs"; | ||
import { getRegionalBlobStore } from "./regional-blob-store.cjs"; | ||
import { recordWarning } from "./handlers/tracer.cjs"; | ||
import { getMemoizedKeyValueStoreBackedByRegionalBlobStore } from "./storage/storage.cjs"; | ||
var ALL_VARIATIONS = Symbol.for("ALL_VARIATIONS"); | ||
@@ -92,3 +92,2 @@ var NetlifyVaryKeys = /* @__PURE__ */ new Set(["header", "language", "cookie", "query", "country"]); | ||
span, | ||
tracer, | ||
requestContext | ||
@@ -101,34 +100,20 @@ }) => { | ||
} else { | ||
span.recordException( | ||
new Error("lastModified not found in requestContext, falling back to trying blobs") | ||
recordWarning( | ||
new Error("lastModified not found in requestContext, falling back to trying blobs"), | ||
span | ||
); | ||
span.setAttributes({ | ||
severity: "alert", | ||
warning: true | ||
}); | ||
const blobStore = getRegionalBlobStore({ consistency: "strong" }); | ||
const blobKey = await encodeBlobKey(key); | ||
lastModified = await tracer.withActiveSpan( | ||
"get cache to calculate date header", | ||
async (getBlobForDateSpan) => { | ||
getBlobForDateSpan.setAttributes({ | ||
key, | ||
blobKey | ||
}); | ||
const blob = await blobStore.get(blobKey, { type: "json" }) ?? {}; | ||
getBlobForDateSpan.addEvent(blob ? "Cache hit" : "Cache miss"); | ||
return blob.lastModified; | ||
} | ||
const cacheStore = getMemoizedKeyValueStoreBackedByRegionalBlobStore({ consistency: "strong" }); | ||
const cacheEntry = await cacheStore.get( | ||
key, | ||
"get cache to calculate date header" | ||
); | ||
lastModified = cacheEntry?.lastModified; | ||
} | ||
if (!lastModified) { | ||
span.recordException( | ||
recordWarning( | ||
new Error( | ||
"lastModified not found in either requestContext or blobs, date header for cached response is not set" | ||
) | ||
), | ||
span | ||
); | ||
span.setAttributes({ | ||
severity: "alert", | ||
warning: true | ||
}); | ||
return; | ||
@@ -135,0 +120,0 @@ } |
{ | ||
"name": "@netlify/plugin-nextjs", | ||
"version": "5.10.1", | ||
"version": "5.10.2", | ||
"description": "Run Next.js seamlessly on Netlify", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
5892572
0.9%204
2%139133
1.16%