當我 console.log(response) 然后我在終端上得到結果,但是當我使用 res.status(200).json(response); 時 我在 nextjs 項目中遇到此錯誤 &未找到在瀏覽器上router.get("/api/backendData", async (req, res, next) => { dbConnect(); try { Shop.find().then((response) => { res.status(200).json(response); response; console.log("responseess", response); }); } catch (e) { console.log("Error From API Endpoint", e); }});錯誤代碼:(節點:62307)UnhandledPromiseRejectionWarning:TypeError:res.status不是函數┃位于/home/mh/Documents/Shopiy/shopyy_mode/server/server.js:34:11┃位于processTicksAndRejections(內部/process/task_queues.js: 93:5) ┃ (用于node --trace-warnings ...顯示創建警告的位置) ┃ (節點:62307) UnhandledPromiseRejectionWarning:未處理的承諾拒絕。此錯誤的根源是在沒有 catch 塊的情況下拋出異步函數內部,或者拒絕未使用 .catch() 處理的 Promise。要在未處理的 Promise 拒絕時終止節點進程,請使用 CLI 標志 --unhandled-rejections=strict(請參閱 https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode)。(拒絕 ID: 1) ┃ (節點:62307) [DEP0018] DeprecationWarning: 未處理的承諾拒絕已被棄用。將來,未處理的 Promise 拒絕將會以非零退出代碼終止 Node.js 進程。
UnhandledPromiseRejectionWarning:TypeError:
泛舟湖上清波郎朗
2023-09-28 10:16:35