I have a method that calls backend node js API
export async function getServerSideProps(context:GetServerSidePropsContext){
const reqUrl = context.req.url;
const splitUrl = reqUrl?.toString().split('?').pop()?.split('&');
if(!splitUrl) return null;
const searchText = splitUrl[0]?.split('=')[1];
const suburb = splitUrl[1]?.split('=')[1];
if(searchText && suburb){
const _dataService = new ServiceProviderDataService();
const response = await _dataService.searchAdvertisements(searchText, suburb);
const searchTitle = `We found ${response.length} search results for ${searchText} in ${suburb} ..`;
return {
props: {
data: response,
searchTitle:searchTitle,
},
};
}
return null;
}
const SearchResultsPage = (data:ISearchResult[],searchTitle:string) => (
<Main>
<Head>
<meta
name="description"
content={`Elevate your hairstyling experience with Mobile Hairdressers,
the ultimate destination for connecting clients and skilled mobile hairdressers.
Explore our About Us page to learn how we seamlessly bridge the gap between clients and talented stylists,
bringing the salon experience to your doorstep.
Discover the convenience, expertise, and personalized service that define our mobile hairdressing platform`}
/>
</Head>
<SearchResults searchTitle={searchTitle} searchResults={data} />
</Main>
);
The above code works in local (npm run build, npm run start, npm run dev). When I upload to my ubuntu server, the getserversideprops waits a long time and returns a ECONNN TIMEOUT. I can confirm the API is returning data (as I previously said, this is all working well in localhost)