RSSHub-Radar icon indicating copy to clipboard operation
RSSHub-Radar copied to clipboard

fetch API issue- code: 'UND_ERR_CONNECT_TIMEOUT'

Open Rupert91 opened this issue 6 months ago • 0 comments

image 在nextjs 14.2.1里调用radar rules的api,总是显示timeout,不管是用axios方法还是用fetch方法。以下是我的代码:

export default async function Page() { try { const response = await fetch('https://rsshub.app/api/radar/rules, { next: { revalidate: 10 }, // Set revalidation interval if needed });

if (!response.ok) {
  throw new Error('Failed to fetch data');
}

const data = await response.json();

console.log(data); // You can log the fetched data

return (
  <div>
    <h1>Fetched Data</h1>
    <pre>{JSON.stringify(data, null, 2)}</pre>
  </div>
);

} catch (error) { console.error('Error fetching data:', error); return

Failed to fetch data
; } }

想知道怎么回事

Rupert91 avatar Aug 25 '24 12:08 Rupert91