Unverified Commit 98232c8c authored by itz-Me-Pj's avatar itz-Me-Pj Committed by GitHub

Fix: Error Fetching _devpagesmanifest.json #17274 (#60349)

Closes NEXT-
Fixes #17274 Error Fetching _devpagesmanfest.json

---------
Co-authored-by: 's avatarJJ Kasper <jj@jjsweb.site>
parent 875dee99
...@@ -64,7 +64,8 @@ export default class PageLoader { ...@@ -64,7 +64,8 @@ export default class PageLoader {
return window.__DEV_PAGES_MANIFEST.pages return window.__DEV_PAGES_MANIFEST.pages
} else { } else {
this.promisedDevPagesManifest ||= fetch( this.promisedDevPagesManifest ||= fetch(
`${this.assetPrefix}/_next/static/development/${DEV_CLIENT_PAGES_MANIFEST}` `${this.assetPrefix}/_next/static/development/${DEV_CLIENT_PAGES_MANIFEST}`,
{ credentials: 'same-origin' }
) )
.then((res) => res.json()) .then((res) => res.json())
.then((manifest: { pages: string[] }) => { .then((manifest: { pages: string[] }) => {
...@@ -98,7 +99,8 @@ export default class PageLoader { ...@@ -98,7 +99,8 @@ export default class PageLoader {
// TODO: Decide what should happen when fetching fails instead of asserting // TODO: Decide what should happen when fetching fails instead of asserting
// @ts-ignore // @ts-ignore
this.promisedMiddlewareMatchers = fetch( this.promisedMiddlewareMatchers = fetch(
`${this.assetPrefix}/_next/static/${this.buildId}/${DEV_MIDDLEWARE_MANIFEST}` `${this.assetPrefix}/_next/static/${this.buildId}/${DEV_MIDDLEWARE_MANIFEST}`,
{ credentials: 'same-origin' }
) )
.then((res) => res.json()) .then((res) => res.json())
.then((matchers: MiddlewareMatcher[]) => { .then((matchers: MiddlewareMatcher[]) => {
......
...@@ -323,7 +323,7 @@ export function createRouteLoader(assetPrefix: string): RouteLoader { ...@@ -323,7 +323,7 @@ export function createRouteLoader(assetPrefix: string): RouteLoader {
styleSheets.set( styleSheets.set(
href, href,
(prom = fetch(href) (prom = fetch(href, { credentials: 'same-origin' })
.then((res) => { .then((res) => {
if (!res.ok) { if (!res.ok) {
throw new Error(`Failed to load stylesheet: ${href}`) throw new Error(`Failed to load stylesheet: ${href}`)
......
...@@ -1156,6 +1156,26 @@ function runTests({ dev }) { ...@@ -1156,6 +1156,26 @@ function runTests({ dev }) {
} }
` `
) )
await check(async () => {
const response = await fetchViaHTTP(
appPort,
'/_next/static/development/_devPagesManifest.json',
undefined,
{
credentials: 'same-origin',
}
)
// Check if the response was successful (status code in the range 200-299)
if (!response.ok) {
return 'fail'
}
const contents = await response.text()
const containsAddedLater = contents.includes('added-later')
return containsAddedLater ? 'success' : 'fail'
}, 'success')
await check(async () => { await check(async () => {
const contents = await renderViaHTTP( const contents = await renderViaHTTP(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment