Next.js Discord

Discord Forum

This Serverless Function has TimedOut

Unanswered
Mini Satin posted this in #help-forum
Open in Discord
Mini SatinOP
I am receiving this error when building in vercel, how to avoid that? I read that the server component tries for 10s to get the data before throw, do I need to use Edge Runtime? How do I use that?

I am using next 14

16 Replies

Mini SatinOP
up
It's error from server side.
check logs
on vercel
Czechoslovakian Wolfdog
I'm having that error too, but it is working on localhost
yeah, in localhost it can show dev error
on prod, it can't
Czechoslovakian Wolfdog
in my case, I have an api endpoint called echo, which only sends an OK.
when I called it via postman I get the error,
if you have any issues, create a new post, as this is another person's post. Thank you.
Czechoslovakian Wolfdog
sure
Mini SatinOP
This is the error @averydelusionalperson @Czechoslovakian Wolfdog
This is my component
import { COLLECTIONS_REF } from "@/enums/collections_ref";
import { getEightCommentsFromLocation } from "@/services/comments";
import { getConnectRoutesByOwner } from "@/services/connectroutes";
import { serializeData } from "@/utils/firebase";
import { doc } from "firebase/firestore";
import { notFound } from "next/navigation";
import { Locale } from "@/i18n.config";
import { getConnectGuideById } from "@/services/connectguides";
import { PeopleLayout } from "../../../components/PeopleLayout";

type ConnectGuidesPageProps = {
  params: {
    id: string;
    locale: Locale;
  };
};

export async function ConnectGuidesPage({ params }: ConnectGuidesPageProps) {
  const [connectGuide, connectRoutes, comments] = await Promise.all([
    getConnectGuideById(params.id).then(serializeData),
    getConnectRoutesByOwner(params.id).then(serializeData),
    getEightCommentsFromLocation(
      doc(COLLECTIONS_REF.CONNECTGUIDES, params.id),
    ).then(serializeData),
  ]);

  if (!connectGuide) notFound();

  return (
    <PeopleLayout
      people={connectGuide}
      connectroutes={connectRoutes}
      comments={comments}
      locale={params.locale}
    />
  );
}
The problem seems to be on the server side fetch functions, that takes longer than 10 sec for my hobby plan
I am currently trying to use edge functions, but doesn't seem to have any leads on this