Next.js "run dev" fails with "Error: [object Object]"

Next.js "run dev" fails with "Error: [object Object]"

Next.js 的新手,不确定如何开始调试它。代码可以在这里找到:

https://github.com/madeupname/ts-next-amplified/blob/main/README.md

背景:我遵循了Amplify Next.js tutorial(虽然Amplify可能与此无关),但选择了TypeScript作为语言。我添加了一个空白 tsconfig.json,它被检测并填充。此时只有 .ts 文件是从 Amplify 生成的代码。 运行 'next dev' 给我一个非常不透明的错误:

错误:[对象对象]

来自的调用堆栈未列出任何项目代码,所以我不确定如何调试它:

Call Stack
DevServer.renderToResponse
file:///C:/Java/Source/ts-next-amplified/node_modules/next/dist/server/next-server.js (1631:72)
processTicksAndRejections
internal/process/task_queues.js (93:5)
async DevServer.pipe
file:///C:/Java/Source/ts-next-amplified/node_modules/next/dist/server/next-server.js (1148:25)
async Object.fn
file:///C:/Java/Source/ts-next-amplified/node_modules/next/dist/server/next-server.js (949:21)
async Router.execute
file:///C:/Java/Source/ts-next-amplified/node_modules/next/dist/server/router.js (222:32)
async DevServer.run
file:///C:/Java/Source/ts-next-amplified/node_modules/next/dist/server/next-server.js (1125:29)
async DevServer.run
file:///C:/Java/Source/ts-next-amplified/node_modules/next/dist/server/dev/next-dev-server.js (439:20)
async DevServer.handleRequest
file:///C:/Java/Source/ts-next-amplified/node_modules/next/dist/server/next-server.js (320:20)

尝试在 IntelliJ 中进行调试,但“异常时切换中断”在这里不起作用。

IntelliJ 和“next lint”未显示编码警告或错误。

我有一个非常相似的错误。

Server Error
Error: [object Object]

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Call Stack
DevServer.renderToResponse
file:///Users/***/***/***/node_modules/next/dist/server/next-server.js (1641:72)
runMicrotasks
<anonymous>
processTicksAndRejections
node:internal/process/task_queues (96:5)
async DevServer.pipe
file:///Users/***/***/***/node_modules/next/dist/server/next-server.js (1158:25)
async Object.fn
file:///Users/***/***/***/node_modules/next/dist/server/next-server.js (959:21)
async Router.execute
file:///Users/***/***/***/node_modules/next/dist/server/router.js (222:32)
async DevServer.run
file:///Users/***/***/***/node_modules/next/dist/server/next-server.js (1135:29)
async DevServer.run
file:///Users/***/***/***/node_modules/next/dist/server/dev/next-dev-server.js (445:20)
async DevServer.handleRequest
file:///Users/***/***/***/node_modules/next/dist/server/next-server.js (325:20)

已通过将 Next.js 从 12 降级到 11 来修复此问题。 目前,Amplify 不支持 Next.jsv12。

https://github.com/aws-amplify/amplify-console/issues/2343