What Causes This Warning?
This warning appears when Nuxt’s client-side navigation tries to preload a page’s payload but the request fails. Payloads contain pre-rendered data that speeds up navigation.
Common Causes
- Payload file doesn’t exist
- Network error
- CORS issues
- Server not serving payload files
- Wrong base URL configuration
The Fix
Check Build Output
# Ensure payloads are generated
npm run build
# Look for payload files
ls -la .output/public/**/_payload.json
Verify Server Configuration
// nuxt.config.ts
export default defineNuxtConfig({
// Ensure payload extraction is enabled
experimental: {
payloadExtraction: true
}
})
Fix Base URL
// nuxt.config.ts
export default defineNuxtConfig({
app: {
baseURL: '/' // Must match deployment
}
})
Network Issues
Check DevTools
- Open Network tab
- Navigate to a page
- Filter by
_payload - Check for failed requests
CORS Configuration
// nuxt.config.ts
export default defineNuxtConfig({
nitro: {
routeRules: {
'/**/_payload.json': {
headers: {
'Access-Control-Allow-Origin': '*'
}
}
}
}
})
Server Configuration
Nginx
location ~ /_payload\.json$ {
add_header Cache-Control "public, max-age=3600";
try_files $uri =404;
}
Apache
<FilesMatch "_payload\.json$">
Header set Cache-Control "public, max-age=3600"
</FilesMatch>
Vercel
// vercel.json
{
"headers": [
{
"source": "/(.*?)/_payload.json",
"headers": [
{ "key": "Cache-Control", "value": "public, max-age=3600" }
]
}
]
}
Fallback Behavior
When payload preload fails, Nuxt falls back to server-side rendering:
<script setup>
// This still works even if payload fails
const { data } = await useFetch('/api/data')
// Data will be fetched server-side instead
</script>
Disable Payload Preloading
If issues persist:
// nuxt.config.ts
export default defineNuxtConfig({
experimental: {
payloadExtraction: false
}
})
Route-Specific Issues
Check Route Rules
// nuxt.config.ts
export default defineNuxtConfig({
routeRules: {
// Ensure prerendered routes have payloads
'/products/**': {
prerender: true
},
// Disable for problematic routes
'/dynamic/**': {
prerender: false
}
}
})
Manual Route Configuration
// nuxt.config.ts
export default defineNuxtConfig({
nitro: {
prerender: {
routes: [
'/',
'/about',
'/products'
],
ignore: [
'/api/**',
'/admin/**'
]
}
}
})
Debugging
Check Payload URL
<script setup>
onMounted(() => {
// See what payload URL is being requested
console.log('Base URL:', useRuntimeConfig().app.baseURL)
})
</script>
Verify Payload Content
# Check if payload exists and is valid JSON
curl -s http://localhost:3000/_payload.json | jq .
Network Interceptor
// plugins/debug-payload.client.ts
export default defineNuxtPlugin(() => {
if (process.dev) {
const originalFetch = window.fetch
window.fetch = async (...args) => {
const url = args[0]?.toString() || ''
if (url.includes('_payload')) {
console.log('Fetching payload:', url)
}
return originalFetch(...args)
}
}
})
CDN Issues
With CDN
// nuxt.config.ts
export default defineNuxtConfig({
app: {
// Keep payloads on origin
cdnURL: process.env.CDN_URL || ''
},
nitro: {
// Ensure payloads aren't cached incorrectly
routeRules: {
'/**/_payload.json': {
headers: {
'Cache-Control': 'public, max-age=60, stale-while-revalidate=600'
}
}
}
}
})
Quick Checklist
- Payloads are generated in
.output/public - Server serves
_payload.jsonfiles - Base URL matches deployment
- No CORS issues blocking requests
- CDN properly forwards payload requests
- Cache headers allow payload updates
- Check browser console for specific errors