Nuxt 3 on Vercel - SWR/ISR issues and
I am having two types of issues on Vercel right now, and I feel like they came out of the blue since I wasn't changing any code when this started happening (last 24 hours).
A) Client side errors with console logs like: Failed to find a valid digest in the 'integrity' attribute for resource 'https://my-commit-name.vercel.app/_nuxt/CFIb-zog.js' with computed SHA-384 integrity 'N5IfvMkgDYriwB7nB453NzJRZKbn/5YL7ewLms9RVqdI8GDsoGq3w'. The resource has been blocked.
If I hard-refresh, this gets fixed, but happens again whenever I deploy.
B) If I have swr: true for a specific route I get redirected on the client from from /some-path to /some-path-isr (always postfixing the route with -isr). Only happens if this is my initial route.
Does this ring any bells for anyone? I am on Nuxt 3.18.1, but I feel like it's not related to that.
2 Replies
Hi @Leopold Kristjansson. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Let's address your two issues with Nuxt 3 on Vercel:
---
A) Integrity Attribute Errors on JS Chunks
The error:
- Integrity errors are a known artifact of atomic deployments and asset hashing. - SWR should not cause route suffix changes; this is not documented behavior and may indicate a bug or misconfiguration. - Keep your Nuxt and Nitro versions up to date, especially if using advanced caching features. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Failed to find a valid digest in the 'integrity' attribute for resource '.../_nuxt/CFIb-zog.js'...This typically happens when the browser tries to load a JS chunk whose content hash (and thus its integrity value) has changed, but the HTML still references the old hash. This is common after a deployment, especially if the user has a stale HTML page cached, but the referenced JS files have been replaced by a new deployment. Hard-refreshing works because it forces the browser to reload the HTML and all assets, syncing the references. This is a known issue in SPAs and SSR apps with hashed assets, especially on platforms like Vercel or Cloudflare where deployments are atomic and old assets may be purged quickly. Relevant Nuxt docs: Nuxt provides built-in support for handling chunk loading errors by performing a hard reload when a chunk fails to load during route navigation. You can customize this behavior with the
experimental.emitRouteChunkError
option if needed. See the Nuxt error handling docs for more details.
---
B) SWR Route Redirects to -isr
Suffix
You mention that with swr: true
in your routeRules
, you get redirected from /some-path
to /some-path-isr
on initial load.
There is no explicit documentation in the provided sources about Nuxt or Vercel automatically redirecting SWR routes to a -isr
suffixed path. Normally, swr
and isr
are cache strategies you define in your routeRules
for hybrid rendering, and they should not alter the route path itself. Example usage:
This should cache the response but not change the URL path for the user. If you are seeing a redirect to a -isr
path, this is unexpected and not described in the official documentation or known issues in the sources provided. It may be a bug or a misconfiguration, possibly related to recent changes in Nitro or Vercel's deployment behavior. There was a recent issue with ISR cache not working due to Nitro changes, but it was resolved in Nitro v2.12.6, so make sure your dependencies are up to date if you are using ISR features [Isr cache not working since nitro observability].
---
Recommendations
- For the integrity error, this is a common deployment artifact. Consider configuring your CDN or Vercel to retain old assets for a short period after deployment, or inform users to hard-refresh if they encounter this.
- For the SWR redirect issue, double-check your routeRules
and ensure there are no custom redirects or middleware that could be causing this. If the problem persists, it may be worth opening an issue with a reproduction, as this is not standard Nuxt/Vercel behavior according to the current documentation [Hybrid Rendering].
If you need more targeted help, providing a minimal reproduction or sharing your nuxt.config
and deployment logs may help the community diagnose the issue further.
---
Summary:- Integrity errors are a known artifact of atomic deployments and asset hashing. - SWR should not cause route suffix changes; this is not documented behavior and may indicate a bug or misconfiguration. - Keep your Nuxt and Nitro versions up to date, especially if using advanced caching features. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@473950899908378635> Kapa.ai is still learning and improving, please let me know how I did by reacting below.