From 0b2540d3b69f9e4a89e53dfdfaf4cd0494ad73bb Mon Sep 17 00:00:00 2001 From: David Hacker Date: Wed, 4 Mar 2020 10:15:13 -0800 Subject: [PATCH] Allow ALEXA_APPLICATION_ID to be null --- index.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 59332dd..705e4aa 100644 --- a/index.js +++ b/index.js @@ -335,13 +335,15 @@ function ping_on_blocking_download(id, callback) { } app.pre = function(req, res, type) { - if (req.data.session !== undefined) { - if (req.data.session.application.applicationId !== process.env.ALEXA_APPLICATION_ID) { - res.fail("Invalid application"); - } - } else { - if (req.applicationId !== process.env.ALEXA_APPLICATION_ID) { - res.fail("Invalid application"); + if (process.env.ALEXA_APPLICATION_ID != null) { + if (req.data.session !== undefined) { + if (req.data.session.application.applicationId !== process.env.ALEXA_APPLICATION_ID) { + res.fail("Invalid application"); + } + } else { + if (req.applicationId !== process.env.ALEXA_APPLICATION_ID) { + res.fail("Invalid application"); + } } } };