When I try to make an on-demand revalidation API call on Vercel, it takes so long that it ends up timing

Inspired by Kent C. Dodds, I have created a blog using Github as my Content Management System (CMS). All of my blog content is stored in the same repository as the code, in mdx format. To streamline the process, I set up a workflow that detects changes in the directory and sends the names of the files altered to the server at "/api/revalidate". The server then downloads the updated files from Github, compiles them (since I use mdx), and stores them in the database. However, this entire operation is taking too long and resulting in a "timeout exceeded 10s" error on Vercel. Any suggestions for improving this process?

Answer №1

I am encountering a similar issue. When I retrieve a document from a Firestore collection to build my page, everything functions correctly in both local and Pro-plan environments. Surprisingly, the execution time seems to be significantly longer than expected, taking around 10 seconds. Strangely enough, when I tested with the Pro plan, it only took about a second to complete.

One potential solution that comes to mind is following the steps outlined by Vercel's guide on optimizing serverless function execution times (guide). Alternatively, you could consider moving your project to a free 14-day trial of the Pro plan to see if this resolves the issue for you.

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

Best practice for organizing initializer code in Next.js

I am currently developing a NextJS app alongside NX app that utilizes firestore as the backend. Within my setup, I have set up api routes and implemented a library for managing feature-based functionalities, such as: initFirebaseAdmin export const initFi ...

React's conditional statement is malfunctioning

I am attempting to display a specific form for review if the user meets the following criteria: 1. Logged in 2. Not an administrator 3. Not a moderator My code currently looks like this: <h2>Write a Review</h2> {errorResortReview &a ...

Using the foreach Loop in Javascript and AngularJs

Having trouble with a foreach loop because you're not sure of the column name to access specific data? Here's a solution to display all columns along with their corresponding data: angular.forEach(data, function(value, key) { console.log( &a ...

The error message UnhandledPromiseRejectionWarning is triggered due to a TypeError stating that the function authenticate is

Currently, I am attempting to incorporate basic authentication into my API project using Knex, Express, and MySQL. Here are the functions I have implemented: const users = [{ id:1, username:'selia', password:'fullservice'}] functio ...

Why does my function consistently notify me that my answer is incorrect?

I've created a fun Pi quiz function that awards half a point for each correct digit you type. However, even if I enter just '3', it always shows as incorrect. Can someone assist me with this issue? function pi() { var piWithoutDecimals ...

Switch between various components using multiple buttons in Next.js

I am in the process of creating a component that will display different components depending on which button the user selects. Here are the available “pages”: ` const navigation = [ { name: "EOQ", return: "<EOQgraph />" }, { nam ...

Tips for updating specific properties of an object within a MongoDB database using arrays

I have encountered a problem with updating only specific properties of an object in my MongoDB database. While the query I'm using is working for most variables, it unexpectedly sets certain arrays (media: [] and sports: []) in the athleteProfile back ...

Error: Request to play the media was disrupted due to a pause() call

Can't seem to figure out how to resolve this error showing up in the chrome dev tools. Any thoughts on a solution? Here's the snippet of my code: const [playing, setPlaying] = useState<boolean>(false); const musicPlayers = use ...

The $dbServiceProvider in AngularJS, Sqlite, Electron seems to be unrecognized

I am currently working on an electron app that is supposed to display and retrieve items from a SQL database I created. However, I keep encountering an unknown provider error. Despite trying various solutions found online, the issue persists and I am unab ...

Store the information in the user interface of React by converting it into a file format

Currently, I am retrieving data from an API and downloading a specific file. My goal is to store this same file in the public directory within my react application. https://i.sstatic.net/bS8Z4.png this.state = { fileDownloadUrl: null, fileName ...

The Ultimate Showdown: NextJS 13 Client vs Server Component

As I embark on creating a straightforward login/register page, I find myself pondering whether it should lean towards being a client or server component. The NextJS 13 documentation suggests that data fetching should be handled by server components to ensu ...

Is there a way to verify if the object's ID within an array matches?

I am looking to compare the ID of an object with all IDs of the objects in an array. There is a button that allows me to add a dish to the orders array. If the dish does not already exist in the array, it gets added. However, if the dish already exists, I ...

Experiment with re-rendering advertisements using Vue.js

Hey there, I'm new around here so please be patient with me if I make any mistakes :D So, onto my question! I have a website built with vuejs and I want to incorporate some ads into it. To do this, I have created some components: <template> ...

What is the method to retrieve the return value from this ajax request?

Here's a code snippet: var information = { ObtainInfo : function() { var url = 'http://www.bungie.net/api/reach/reachapijson.svc/game/info/'+storage.get('apikey'); $.ajax({ url: url, su ...

InternJS - Unresolved TypeError: The undefined object does not have a property named 'readFile'

I am currently facing an issue with Intern.js during functional testing. The error mentioned in the title has me puzzled as I struggle to figure out how to successfully load json files through FS or require. Despite my best efforts and extensive searches o ...

Issues with MC-Cordova-Plugin on Ionic and Angular Setup

Recently, I integrated a plugin for Ionic from this repository: https://github.com/salesforce-marketingcloud/MC-Cordova-Plugin After successfully configuring it for iOS, I encountered difficulties on Android where the plugin seems to be non-existent. It ...

The NextJs 404 page is stuck in a continuous loop, reloading itself every few seconds

I've been referring to the documentation at https://nextjs.org/docs/app/api-reference/file-conventions/not-found However, despite everything working fine, my not found page keeps reloading every second. Here's the code for my not found page: ...

Group By feature in AngularJS

Hey there, I'm trying to display a table from the code provided below. The issue I'm facing is with grouping by name. Here's how I want the view to appear: Shareholder | Preferred Stock | Common Stock | Options | Percentage | |----------- ...

Ways to avoid unintentional removal of contenteditable unordered lists in Internet Explorer 10

How can I create a contenteditable ul element on a webpage while avoiding the issue in Internet Explorer 10 where selecting all and deleting removes the ul element from the page? Is there a way to prevent this or detect when it happens in order to insert ...

Using Vue.js to mark a checkbox as selected

I've searched extensively and tried various combinations, but I'm unable to initialize my checkboxes as checked. For example: <ul class="object administrator-checkbox-list"> <li v-for="module in modules"> <label v-bin ...