mayunyi
V2EX  ›  Next.js

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

  •  
  •   mayunyi · Nov 22, 2023 · 1942 views
    This topic created in 971 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   ·   4172 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 148ms · UTC 05:18 · PVG 13:18 · LAX 22:18 · JFK 01:18
    ♥ Do have faith in what you're doing.