After sending a POST request to another backend server, it takes a long time to receive the response. Is there a way to solve this?

  console.log(
    "Flask server URL:",
    process.env.NEXT_PUBLIC_FLASK_REDIRECT_URL
  );

  const response = await fetch(
    `${process.env.NEXT_PUBLIC_FLASK_REDIRECT_URL!}/process`,
    {
      method: "POST",
      body: formData,
      signal: controller.signal,
    }
  );

  clearTimeout(timeoutId);

  if (!response.ok) {
    throw new Error("Failed to send PDF to Flask server");
  }

This is codes on my page.tsx client code. And it request to Flask server which is deployed on AWS EC2. But this request consume usually 5 minutes. And currently, the vecel handle this as an error, because it doesn’t get response from server. I am trying to time sleep code, but it does not work. Can I change the option through vercel as even there is no response for 5 minutes, it is not an error?

Deployment URL or Custom Domain: https://vercel.com/jun-songs-projects/business-contract-analyzer
Environment (local, preview, production): Client code - vercel, Flask server - AWS EC2
Project Framework:
Build Settings:
  Framework Preset:
  Build Command (if not default):
  Output Directory (if not default):
  Install Command (if not default):
Node/Runtime Version:
Package Manager:
Relevant Packages:

Hi @songjeongjun320 , welcome to the Vercel community!

Could you please check how long it takes to receive a response from the other server? You can use tools like curl or Postman to verify this, which will help us identify where any delays may be occurring.

For more details on using Postman to check response times, you can refer to this guide: Postman Response Time.

Let us know how it goes!

Hello neerajkumar!

Depends on the pdf file which is sent from client to flask server, It is almost 5minutes.
Which means that the vercel should not detect it is an error for 5minutes even the vercel could not get any response from it. Would it be possible to change the option for this?

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