diff --git a/lib/note/noteActions.js b/lib/note/noteActions.js index dcef41e2..b8a34ad7 100644 --- a/lib/note/noteActions.js +++ b/lib/note/noteActions.js @@ -83,7 +83,7 @@ function actionPDF (req, res, note) { const noteId = req.params.noteId if (req.method === 'POST') { - const token = jwt.sign({ userId: req.user.id.toString() }, config.codimdSignKey, { expiresIn: 5 * 60 }) + const token = req.user && jwt.sign({ userId: req.user.id.toString() }, config.codimdSignKey, { expiresIn: 5 * 60 }) const noteURL = `${config.serverURL}/${noteId}/pdf`