The MaxDuration feature for a 5-minute time limit is malfunctioning on the Serverless Pro Plan, resulting in a 504 ERROR on

I am currently using Next.js@latest with App Directory

My application is hosted on Vercel

I'm experiencing a 504 error from Vercel and I'm on the pro plan. My serverless functions are set to run for up to 5 minutes, but usually, they only take about 2-3 minutes to complete.

When checking the logs, I can see that the serverless function is returning a 200 status code and running correctly. However, when accessed through the browser or postman, it times out after approximately 1 minute and returns a 504 error.

Everything seems to work fine locally. What could be causing this issue?

app/api/generators/article/refine/route.ts

import { type NextRequest } from "next/server";

import { type GetArticle } from "@/types/types";
import GeneratorsAPI from "@/lib/GeneratorsApi/GeneratorsAPI";

export const maxDuration = 300;

export async function POST(request: NextRequest) {
  const payload = (await request.json()) as GetArticle;

  return await GeneratorsAPI.getInstance().getRefinedArticle(payload);
}

lib/GeneratorsAPI

async getRefinedArticle(payload: GetArticle) {
    try {
      this.validatePayloadWith(this.articleValidator, payload);

      const response = await axios.post(this.REFINED, payload, {
        headers: this.headers,
        timeout: 300000,
      });

      const data = response as ArticleAPIReturnType;
      return NextResponse.json({ data: data.data.data }, { status: 200 });
    } catch (err) {
      const error = handleError(err, "getRefinedArticle");

      return NextResponse.json(
        { message: error.message },
        { status: error.errorCode },
      );
    }
  }

This information is extracted from VERCEL LOGS for /refine route

Status Code: 200
Execution duration/limit: 1m 45.76s / 250s
function: /api/generators/article/refine
Environment: production

Answer №1

There was a problem on Vercel's end, but it has since been resolved.

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

What is the best way to display HTML in this particular situation?

This is the function I am working on: public static monthDay(month: number): string { let day = new Date().getDay(); let year = new Date().getFullYear(); return day + ", " + year; } I am trying to add <span></span> tags around ...

Transporting a Typescript file to the customer using JavaScript

As a newcomer to typescript and in the process of creating a small application in visual studio 2013, I have noticed that when viewing the project in Chrome's developer tools, typescript files (*.ts) are being downloaded to the client. This could pote ...

Merge mocha with Typescript, and include the watch feature

For my project, I have set up mocha to test my Typescript code. The issue arises when running the command: mocha ts/test --compilers ts:typescript-require Every time I make a change, it fails with an error message like this: error TS2307: Cannot find mo ...

What is the process for creating a nullable column in TypeORM?

Within my User entity, there is an optional column for the user's avatar image: @Entity() export class User { @PrimaryGeneratedColumn('uuid') id: string @Column({ unique: true }) email: string @Column({ unique: true }) ...

What is the reason behind Typescript executing the abstract class before anything else?

I'm currently facing a challenge solving an abstract class problem with Typescript. Let me explain what I am trying to accomplish. There is a class named Sword that extends Weapon. Each Weapon must have certain properties like the damage, but since e ...

Eradicate lines that are empty

I have a list of user roles that I need to display in a dropdown menu: export enum UserRoleType { masterAdmin = 'ROLE_MASTER_ADMIN' merchantAdmin = 'ROLE_MERCHANT_ADMIN' resellerAdmin = 'ROLE_RESELLER_ADMIN' } export c ...

The Hapi response fails to display JSON data in a nested tree format

Hey there! I've got this object with a specific structure. Here it is: interface FolderWithContent { uuid: string name: string; folders: Array<FolderWithContent>; files: Array<Files>; } Just a heads up, Files is an extens ...

Guide on setting up create-next-app with version 12 instead of the latest version 13

For an upcoming Udemy course, I am required to develop a Next.js project. However, it specifically needs to be built using Next.js version 12 rather than the latest version 13. Does anyone know how I can achieve this? ...

Prisma Date and Time Formatting Challenge

Exploring Nest Js and prisma led me to the need to store DateTime data in my database based on my timezone preferences. joining DateTime @db.Timestamptz(5) ` I found that using @db.Timestamptz resolved my timezone storage issue, but upon retriev ...

Detecting errors on the client side with JSON payload in Next.js and a personalized server

Working with Next.js and a custom Express server, I've encountered an issue regarding basic API error handling. I have set up a simple error handling middleware that looks like this: app.use((err, req, res) => { res.status(400).send(message); ...

Leverage the power of TypeScript by enabling the noImplicitAny flag when working

Currently, I am looking to activate the noImplicitAny flag in my compiler. My main issue lies with utilizing lodash/fp as there are no typings available at this moment. Due to this, the compiler is generating errors due to the absence of a definition file ...

Steps for linking HTTP requests in Angular 2 depending on the type of response

My attempt to create an api call from a remote server and then, if an error occurs, make another request from my local server is not working as expected. I am encountering errors and need help to determine if my approach is feasible. Here is the code snip ...

Adding a layer of middleware (insights) to enhance the functionality of Instantsearch in

Our search functionality using Algolia/Instantsearch/React/Nextjs is working well, but we have yet to set up the Insights middleware. We have implemented custom widgets for more specific control over how results are displayed as shown below. For our cust ...

Discovering the JavaScript source file for a package using WebStorm and TypeScript

In my TypeScript project, there is a usage of Express with the following method: response.send('Hello'); I am interested in exploring the implementation of the send() method. However, when I try to navigate to the source code by ctrl+clicking o ...

SvelteKit is having trouble with identifying Typescript syntax

I was working on a SvelteKit project with TypeScript (set up with Vite) and everything was running smoothly with "npm run dev". However, when I attempted to publish the app on Github Pages, an error popped up (on localhost) as I hovered over the only link ...

Sequentially arranged are the assignments in Firebase functions

I recently came across an article on Firebase task functions published by Google, where it was mentioned that tasks should be dispatched in a first-in-first-out (FIFO) order. Despite trying different settings, the tasks are not being processed in the corre ...

Pattern Matching for Excluding Multiple Specific Phrases

I need to restrict what a user can enter into a field based on previous entries that are already in the system. For instance, the user has already entered these values into the database: ["typescript", "C#", "python"] If they type one of these existing ...

Loading a page in Next.js with Redux before the completion of fetching data actions in getInitialProps

My current issue involves fetching data from an API by triggering a 'getItems' action in getInitialProps on a page (let's call it page A). The data is successfully fetched when I navigate to page A from another page using Link(next/link). ...

The specified React element type is not valid

Currently working on a web application using Typescript, Electron, Webpack, and NodeJS, but encountering issues with the import/export functionality. The error message that I am facing reads: "Warning: React.createElement: type is invalid -- expect ...

Issue with Parcel / React 18 App.js failing to refresh cache

Currently, I am developing a React application for my school project. However, I have encountered an issue where certain components are not rendering in my App.js file. Strangely, when I place these components as child components of App.js, they do render ...