mayunyi
V2EX  ›  Next.js

关于 nextjs13app 使用 getData 获取数据,打包报错

  •  
  •   mayunyi · Nov 22, 2023 · 1757 views
    This topic created in 908 days ago, the information mentioned may be changed or developed.

    async function getData() { const response = await request.get("/protocol/legal", {status: 2}); if (response.code !== 0) { throw new Error('Failed to fetch data') } return response.data.content; }

    const Legal = async () => { const content = await getData();

    return(<div>....</div>)
    

    }

    打包报错信息如下: Error occurred prerendering page "/protocol/legal". Read more: https://nextjs.org/docs/messages/prerender-error

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1774 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 16:17 · PVG 00:17 · LAX 09:17 · JFK 12:17
    ♥ Do have faith in what you're doing.