Vercel doesn't support Nextjs Link prefetching

My project deployed on https://adrien-bailliard-com.vercel.app/ works perfectly on my local production.

However, on my vercel production, the links prefecthing return 404 errors in the browser’s tab : 952354cdb505a279.js:1 GET [https://]adrien-bailliard-com.vercel.app/newsletter/?_rsc=1r34m 404 (Not Found).

This is very strange. I’m wondering if Vercel has removed this functionality for free plan users.

Thank you for your help! I’ve been looking for an answer for a couple of days

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

Hi @adrienbailliard78-67, welcome to the Vercel Community!

I see that there’s a 404 on the live website you shared. But, I can assure you Vercel would never disable Next.js features based on user plans.

Please share your public repo or a minimal reproducible example. That will let us all work together from the same code to figure out what’s going wrong.

Thank you so much!

Here is my minimal reproducible example : GitHub - adrienbailliard/minimal-reproducible-vercel-bug. Deployed on https://minimal-reproducible-vercel-bug.vercel.app/.

It looks like a Vercel bug due to :

const nextConfig: NextConfig = {
  trailingSlash: true
};

Should I create a GitHub issue, or will you handle it?

Hi @adrienbailliard78-67, thanks for creating the minimal repo but I get an unrelated error:

Can you try recreating this with a fresh CLI: create-next-app | Next.js project?

Hi, with pleasure.
Can’t do better now :slight_smile:

Plublic repo with a fresh CLI : GitHub - adrienbailliard/bug-deployement-vercel.
And here is the deployement : https://bug-deployement-vercel.vercel.app/.

Everything works fine without “trailingSlash: true”.

1 Like

Hi @adrienbailliard78-67, thanks for this repo. I was able to recreate and our team is already on it. I’ll keep you posted here.

Hi @adrienbailliard78-67, so this fix may take some time (early next week) to be fully rolled out. However, only the prefetching is affected and pages load as usual, so this shouldn’t cause any downtime or failures.

I’m working with the team and will keep posting here when I’ve more updates. In the meantime, you can use trailingSlash: false to resolve this. I know this isn’t ideal but this being an eventful week (Black Friday), things take longer.

Hello,

Thank you for your support!
I finally removed trailingSlash: true as it looks more modern without it.

Have a good day!

One thing to keep in mind is that the trailing slash changes the behavior of relative links

With trailingSlash: true, if you are on page /blog/ and you click a link to <a href="home" you will end up at /blog/home/

With trailingSlash: false, if you are on page /blog and you click a link to <a href="home" you will end up at /home

If you use absolute links that start with a / like <a href="/home" then this is not an issue and works the same with or without trailing slashes

Either practice is ok, it’s just important to be aware of it so you know how your links will work

2 Likes

Hi @adrienbailliard78-67, we released a new version of the Vercel CLI when this patch came out.

Because this will roll out next week, you can manually opt into it by setting VERCEL_CLI_VERSION=vercel@48.10.13 in your Vercel project’s environment variables.

I tested it on https://bug-deployement-vercel-mocha.vercel.app/

As a reminder, please remove this variable next Friday so your project can always use the latest CLI version.

I hope this was helpful.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.