Vercel prevents Google from including website in search results

After deploying my Next.js app on Vercel, I encountered an issue where Google's crawl requests were returning a 401 unauthorized error. This problem is also evident in the deployment logs console as indicated below:

Even though I added the URL to the publicRoutes in my middleware file, the website remains inaccessible. Despite thoroughly checking and adjusting the middleware settings, I couldn't identify the root cause of this blockage.

Answer №1

I encountered a similar issue and found a solution that I had come across somewhere, although the exact source eludes me because I had numerous tabs open while attempting to resolve it. In my case, I decided to comment out everything, including the publicRoutes, and instead added the following code snippet:

import { withClerkMiddleware } from "@clerk/nextjs/server";
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";

export default withClerkMiddleware((req: NextRequest) => {
  return NextResponse.next();
});

export const config = {
  matcher: "/((?!_next/image|_next/static|favicon.ico).*)",
};

The use of withClerkMiddleware may be deprecated now, but it has successfully improved the discoverability of my site, as I am eagerly awaiting its indexing.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Authentication with Next.js

I'm embarking on my journey with Nextjs and I've hit a roadblock when it comes to setting up the authentication aspect. I know that Nextjs commonly uses NextAuth for handling authentication. My initial instinct was to integrate providers like Goo ...

What could be the reason for the undefined value of my ID retrieved from the next JS router.query upon page refresh?

When using the id obtained from the next router.query to dynamically render elements, it works fine when accessing the room from next/link. However, upon refreshing the page, an error is thrown. https://i.stack.imgur.com/yEjGS.png Below is the code snipp ...

What are the steps for creating a standalone build in nextJS?

Currently, I am undertaking a project in which nextJS was chosen as the client-side tool. However, I am interested in deploying the client as static code on another platform. Upon generating a build, a folder with all the proprietary server elements of ne ...

Error Message: An issue has occurred with the server. The resolver function is not working properly in conjunction with the next

https://i.stack.imgur.com/9vt70.jpg Encountering an error when trying to access my login page. Using the t3 stack with next auth and here is my [...nextauth].ts file export const authOptions: NextAuthOptions = { // Include user.id on session callbacks ...

The showdown between NextJS local images and CDN images

When it comes to hosting images in a NextJS repository, what is the optimal approach? Should images be served from a CDN link or stored locally within the project and then imported for use? ...

Developing a React-based UI library that combines both client-side and server-side components: A step-by-step

I'm working on developing a library that will export both server components and client components. The goal is to have it compatible with the Next.js app router, but I've run into a problem. It seems like when I build the library, the client comp ...

Learn how to pass an id from the query parameters to the getInitialProps function in Next.js

Looking to create a basic website that displays content from a database? Utilizing the getInitialProps function from Next.js documentation can help with server-side rendering: https://nextjs.org/docs/api-reference/data-fetching/getInitialProps#getinitialpr ...

How do I retrieve the music events for each user in Strapi 4?

I am currently working with strapi 4 and nextjs. Within the app, each user has their own music events stored in strapi that they should be able to add and retrieve. However, I am encountering difficulties when trying to retrieve each user's music ev ...

Transferring an array of objects from one array to another with the click of a button

I'm facing an issue with moving data between two arrays of objects using buttons in a Nextjs project. The functionality works correctly when selecting a single data item, but it gives unexpected results when selecting multiple items. Although my code ...

When utilizing Tailwind and DaisyUI within a Next.js application, I am facing difficulties in getting the navigation bar to extend across the entire webpage

I recently encountered an issue with my next.js app that utilizes DaisyUI, a tailwind-based CSS component library. The problem I'm facing is that no matter what I do, the DaisyUI navbar refuses to stretch all the way across the webpage horizontally. I ...

Using the <video /> tag on a Next.JS page generated on the server side leads to hydration issues

My Next.js app's index page is rendered on the server side by default. During development, I encountered an error that stated: Unhandled Runtime Error Error: Hydration failed because the initial UI does not match what was rendered on the server. Wa ...

Troubleshooting: Next.js with Axios - Receiving 405 Method Not Allowed Error

As I develop a mini forum feature in my Next.js app, I encountered an issue when trying to delete a forum post using axios.delete and an HTML form. Despite the successful deletion from the database, an error message stating "405 Method Not Allowed" is disp ...

NextJS is throwing an error: The prop `href` in `<Link>` should be a `string` or `object`, but it received `undefined` instead

I've encountered an issue while trying to integrate a header section from a GatsbyJS project into my NextJS project. The error message I'm receiving is: "Error: Failed prop type: The prop href expects a string or object in <Link>, but ...

Ways to refresh the session on the server end

What is the process for updating a session in the server side using authV5 in the most recent update of nextjs? I have attempted the following: import { update } from "@/auth However, I am unable to locate the update function within the auth module ...

Exploring the functionality of window.matchmedia in React while incorporating Typescript

Recently, I have been working on implementing a dark mode toggle switch in React Typescript. In the past, I successfully built one using plain JavaScript along with useState and window.matchmedia('(prefers-color-scheme dark)').matches. However, w ...

How can I implement outlets in a Next.js project? In traditional React Router, I would utilize the <outlet> tag to display child components

I'm curious if there is a router outlet implementation in Next.js or a similar framework. My goal is to display child components on the same page using sub-routes, but I haven't come across any solutions for this specific functionality within Nex ...

Having trouble establishing a connection with mongoose and typescript

When attempting to establish a connection using mongoose, I consistently encounter the errors outlined below. However, if I use MongoClient instead, everything functions as expected. import connectMongo from '../../lib/connectMongo' console.log( ...

Utilizing Apollo Client cache for Server-Side Rendering

Currently, I am utilizing @apollo/client in combination with Next.js for Server Side Rendering. The data retrieval process is via wp-graphql, making it essential to render on the server side. However, there is a minor setback - the cache persists indefinit ...

The NextAuth file imported with the EmailProvider is currently not being utilized

Having an issue with implementing nextauth for authentication. I have imported EmailProvider from nextauth/providers but when I try to use it in the Nextauth providers object, it does not recognize the EmailProvider that I've imported. Here is the co ...

What are the steps to resolve the error "Module parse failed: Unexpected character '�' (1:0)"?

I'm encountering an issue in my Js 13 app whenever I try to use a package related to images, specifically a blurhash package called blurhash-from-url. It keeps throwing an error. Error: ./node_modules/sharp/build/Release/sharp-darwin-x64.node Module p ...