ECONNREFUSED: Error occurred prerendering page [app router] #58936
-
I have a backend in rust running in a different port, and I use nextjs to fetch data from it. I have 2 files // client.ts
import 'server-only'
export async function getRecipes(): Promise<Recipe[]> {
const res = await fetch(`${process.env.API_URL}/api/v1/recipes`, {
cache: "no-store",
});
return await res.json();
} import { getRecipes } from "@/lib/client";
// recipes/pages.tsx
export default async function ListRecipes() {
const recipes = await getRecipes();
return (
<div className="sm:mt-8 grid gap-4 grid-cols-1 sm:grid-cols-2 md:grid-cols-3 ">
{recipes.map((recipe) => (
<SmallRecipe recipe={recipe} key={recipe.recipe_id} />
))}
</div>
);
} When running
I don't understand why it needs the rust backend to build. Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
woile
Nov 29, 2023
Replies: 1 comment 4 replies
-
Fixed it by adding to my
See more: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
woile
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed it by adding to my
page.tsx
the folowing:See more: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config