mayunyi
V2EX  ›  Next.js

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

  •  
  •   mayunyi · Nov 22, 2023 · 1821 views
    This topic created in 933 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   ·   986 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 19:08 · PVG 03:08 · LAX 12:08 · JFK 15:08
    ♥ Do have faith in what you're doing.