Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
f3222471
Unverified
Commit
f3222471
authored
May 11, 2023
by
JJ Kasper
Committed by
GitHub
May 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update cache method handling during build (#49633)
This ensures we properly handle fetch cache during build.
parent
ce746ef5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
4 deletions
+18
-4
utils.ts
packages/next/src/build/utils.ts
+2
-0
worker.ts
packages/next/src/export/worker.ts
+1
-0
fetch-cache.ts
...ages/next/src/server/lib/incremental-cache/fetch-cache.ts
+15
-4
No files found.
packages/next/src/build/utils.ts
View file @
f3222471
...
@@ -63,6 +63,7 @@ import { IncrementalCache } from '../server/lib/incremental-cache'
...
@@ -63,6 +63,7 @@ import { IncrementalCache } from '../server/lib/incremental-cache'
import
{
patchFetch
}
from
'../server/lib/patch-fetch'
import
{
patchFetch
}
from
'../server/lib/patch-fetch'
import
{
nodeFs
}
from
'../server/lib/node-fs-methods'
import
{
nodeFs
}
from
'../server/lib/node-fs-methods'
import
'../server/node-environment'
import
'../server/node-environment'
import
*
as
ciEnvironment
from
'../telemetry/ci-info'
export
type
ROUTER_TYPE
=
'pages'
|
'app'
export
type
ROUTER_TYPE
=
'pages'
|
'app'
...
@@ -1216,6 +1217,7 @@ export async function buildAppStaticPaths({
...
@@ -1216,6 +1217,7 @@ export async function buildAppStaticPaths({
}),
}),
CurCacheHandler
:
CacheHandler
,
CurCacheHandler
:
CacheHandler
,
requestHeaders
,
requestHeaders
,
minimalMode
:
ciEnvironment
.
hasNextSupport
,
})
})
return
StaticGenerationAsyncStorageWrapper
.
wrap
(
return
StaticGenerationAsyncStorageWrapper
.
wrap
(
...
...
packages/next/src/export/worker.ts
View file @
f3222471
...
@@ -371,6 +371,7 @@ export default async function exportPage({
...
@@ -371,6 +371,7 @@ export default async function exportPage({
},
},
serverDistDir
:
join
(
distDir
,
'server'
),
serverDistDir
:
join
(
distDir
,
'server'
),
CurCacheHandler
:
CacheHandler
,
CurCacheHandler
:
CacheHandler
,
minimalMode
:
ciEnvironment
.
hasNextSupport
,
})
})
;(
globalThis
as
any
).
__incrementalCache
=
incrementalCache
;(
globalThis
as
any
).
__incrementalCache
=
incrementalCache
curRenderOpts
.
incrementalCache
=
incrementalCache
curRenderOpts
.
incrementalCache
=
incrementalCache
...
...
packages/next/src/server/lib/incremental-cache/fetch-cache.ts
View file @
f3222471
...
@@ -34,10 +34,21 @@ export default class FetchCache implements CacheHandler {
...
@@ -34,10 +34,21 @@ export default class FetchCache implements CacheHandler {
}
}
delete
ctx
.
_requestHeaders
[
FETCH_CACHE_HEADER
]
delete
ctx
.
_requestHeaders
[
FETCH_CACHE_HEADER
]
}
}
if
(
ctx
.
_requestHeaders
[
'x-vercel-sc-host'
])
{
const
scHost
=
this
.
cacheEndpoint
=
`https://
${
ctx
.
_requestHeaders
[
'x-vercel-sc-host'
]}${
ctx
.
_requestHeaders
[
'x-vercel-sc-host'
]
||
process
.
env
.
SUSPENSE_CACHE_URL
ctx
.
_requestHeaders
[
'x-vercel-sc-basepath'
]
||
''
}
`
const
scBasePath
=
ctx
.
_requestHeaders
[
'x-vercel-sc-basepath'
]
||
process
.
env
.
SUSPENSE_CACHE_BASEPATH
if
(
process
.
env
.
SUSPENSE_CACHE_AUTH_TOKEN
)
{
this
.
headers
[
'Authorization'
]
=
`Bearer
${
process
.
env
.
SUSPENSE_CACHE_AUTH_TOKEN
}
`
}
if
(
scHost
)
{
this
.
cacheEndpoint
=
`https://
${
scHost
}${
scBasePath
||
''
}
`
if
(
this
.
debug
)
{
if
(
this
.
debug
)
{
console
.
log
(
'using cache endpoint'
,
this
.
cacheEndpoint
)
console
.
log
(
'using cache endpoint'
,
this
.
cacheEndpoint
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment