我開始嘗試用 node 和 puppeteer 編寫一個 lambda 函數。我正在使用無服務器框架。在我的 handler.js 中:exports.detail = async (event, context) => { console.log(event); let id = event.pathParameters.id || 1; console.log(id);我一直在嘗試使用 event 參數傳入 id 參數,但如果未設置,我希望將值設置為 1 。但是當我嘗試時:$ sls invoke local -f detail {"errorMessage": "Cannot read property 'id' of undefined","errorType": "TypeError","stackTrace": [ "TypeError: Cannot read property 'id' of undefined",我怎樣才能得到這個工作?
無服務器:“errorMessage”:“無法讀取未定義的屬性 'id'”,
Smart貓小萌
2022-10-13 16:00:49