#fetchQuery: TypeError: fetch failed For a fresh *Next.js* X *Convex* Project

11 messages · Page 1 of 1 (latest)

brittle sage
#

Hello I am getting this error when I am trying to run a fetchQuery on a next.js server component

//page.tsx
import { api } from "@/convex/_generated/api";
import { fetchQuery } from "convex/nextjs";

export default async function Home() {
  const numbers = await fetchQuery(api.myFunctions.listNumbers, {
    count: 3,
  });
  console.log("Numbers from server:", numbers);
  return (
    <>
      <header className="sticky top-0 z-10 bg-background p-4 border-b-2 border-slate-200 dark:border-slate-800 flex flex-row justify-between items-center">
        Convex + Next.js
      </header>
      <main className="p-8 flex flex-col gap-16">
        <h1 className="text-4xl font-bold text-center">Convex + Next.js</h1>
      </main>
    </>
  );
}

And on the convex side the default list function

and I am getting this on the console

 GET /.well-known/appspecific/com.chrome.devtools.json 404 in 23ms
 ⨯ TypeError: fetch failed
    at async Home (app/page.tsx:5:18)
  3 |
  4 | export default async function Home() {
> 5 |   const numbers = await fetchQuery(api.myFunctions.listNumbers, {
    |                  ^
  6 |     count: 3,
  7 |   });
  8 |   console.log("Numbers from server:", numbers); {
  digest: '3204391019',
  [cause]: [AggregateError: ] { code: 'ETIMEDOUT' }
}
 GET / 500 in 874ms

Any idea what might be a reason? Any suggestions are welcome 🙏 🥲

bleak dewBOT
#

Thanks for posting in #1088161997662724167.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.

    - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
    - Use [search.convex.dev](https://search.convex.dev) to search Docs, Stack, and Discord all at once.
    - Additionally, you can post your questions in the Convex Community's #1228095053885476985 channel to receive a response from AI.
    - Avoid tagging staff unless specifically instructed.

    Thank you!
untold herald
#

Can you share the listNumbers function definition

brittle sage
untold herald
#

Thanks for sharing!

errant brook
#

ran into this as well!

#

Upgrading to node 24 didn't work :(

deft siren
#

On my windows machine I'm on 23 and its working

jolly wind
#

does anyone know how to solve it with Bun (v1.3.8)

jolly wind
#

tried with
Bun (v1.3.5 & v1.3.8)
Node (v23.5.0, v24.13.0 & v25.0.0)

none worked:')

System:
Linux Mint 22.3

@deft siren @untold herald