question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FetchError: request to https://.../api/v1/projects failed, reason: connect ETIMEDOUT 34.241.115.67:443

See original GitHub issue

What version of Next.js are you using?

^12.0.4

What version of Node.js are you using?

16.13.0

What browser are you using?

Google Chrome

What operating system are you using?

Windows

How are you deploying your application?

next export

Describe the Bug

Getting this error, I don’t really understand why. I really want your help 🙏

My API link: https://mvp4startup-api.herokuapp.com/api/v1/projects

export async function getStaticProps() {
  const res = await fetch(`${server}/api/v1/projects`);
  const projects = await res.json();
  const formations = await fetch(`${server}/api/v1/formations`).then((res) =>
    res.json()
  );
  const businessplans = await fetch(`${server}/api/businessplans`).then((res) =>
    res.json()
  );
  return {
    props: {
      projects,
      formations,
      businessplans,
    },
  };
}

Expected Behavior

I expect to receive data and render it to the page, through props.

To Reproduce

Setup next app (version ^12.0.4) and make a getStaticProps call.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
MonstraGcommented, Nov 30, 2021

this:

export async function getStaticProps() {
	const server = "https://mvp4startup-api.herokuapp.com";
	const res = await fetch(`${server}/api/v1/projects`);
	const projects = await res.json();
	const formations = await fetch(`${server}/api/v1/formations`).then((res) => res.json());
	return {
		props: {
			projects,
			formations
		}
	};
}

works fr me and I can succesfully receive both projects and formations.

Including businessplans gives me FetchError: invalid json response body at https://mvp4startup-api.herokuapp.com/api/businessplans reason: Unexpected end of JSON input

In any case, it doesn’t seem like its an issue with nextjs.

0reactions
KennStack01commented, Nov 30, 2021

just checked using postman here

It works fine, I’ve got the JSON data

But I still got this error while fetching data 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

What version of Next.js are you using? - GitHub
FetchError : request to https://.../api/v1/projects failed, reason: connect ETIMEDOUT 34.241.115.67:443. ... How are you deploying your application?
Read more >
What could cause "connect ETIMEDOUT" error when the URL ...
Anyway, I've got Problem with request: connect ETIMEDOUT when I run the code and I have no idea how to fix it. What...
Read more >
Error: connect ETIMEDOUT - Salesforce Stack Exchange
This is a Temporary issue when the Salesforce API is timed out. ETIMEDOUT comes from the Node.js engine and the error implies.
Read more >
Fetch Error on Dev and Production Builds - Prismic People
FetchError : request to https://nuvinair.prismic.io/api/v2?access_token=[REMOVED] failed, reason: connect ETIMEDOUT 34.238.5.239:443
Read more >
Fixing Etimedout error - Postman
The ETIMEDOUT error means that the request took more time than the webserver configuration allows and the connection has been closed by the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found