mayunyi
V2EX  ›  Next.js

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

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