运行时
yarn build
我收到以下错误:
Error: Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.
这在我本地没有发生,只在远程部署上发生,然后我意识到他们远程使用最新的 amlify 和 next.js 版本:
在本地更新 next.js 后,我设法在本地重现它 - 但未能解决。
有一个 GitHub 问题跟踪此错误:https://github.com/aws-amplify/amplify-ui/issues/1780。已对其进行修复,并将成为下一个软件包版本的一部分。
有趣的是,我遇到了同样的错误,但是在我的 app.js 文件上使用
<ToastContainer />
,只需删除它或找到其他更好的东西