Next.js Discord

Discord Forum

Error: fetch failed When using `fetch` api

Answered
"use php" posted this in #help-forum
Open in Discord
I'm getting this error when using Fetch Api.
I only seem to get this error on edge runtime.

I'll attach a screenshot of the error.
Answered by "use php"
    signal: AbortSignal.timeout(10000)

increasing the timeout worked, I'm not sure how because DynamoDB barely has any latency
View full answer

8 Replies

I'm trying to fetch DynamoDB endpoint
api endpoint**
I've tried:
- Accessing dev server via 127.0.0.1
- Downgrade node version to 18
Original message was deleted
I believe I added sufficient information, But here's more.

Code:
  const response = await fetch(url, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "X-Amz-Target": "DynamoDB_20120810.Scan",
      //...
    },
    body: JSON.stringify(requestBody)
  });
console:
I'll try increasing the timeout also, but it usually doesn't take that long
    signal: AbortSignal.timeout(10000)

increasing the timeout worked, I'm not sure how because DynamoDB barely has any latency
Answer