I have separated the API calling functions in a separate custom.js
and using const custom = require('./custom.js)
.
Here is the skeleton of my js
file:
const request = require("request-promise");
const accessToken = "xxxxxxx-xxxxxx";
const apiBase = "https://api.myapihandler/v1/";
module.exports = {
email_search_result: async (deliveryType, resultType, status) => {
let data = {};
await request({
url: apiBase + "emails/search",
qs: {
accessToken: accessToken,
deliveryType: deliveryType,
automatedResults: resultType,
status: status
},
method: "GET"
})
.then(body => {
data = JSON.parse(body);
})
.catch(error => {
console.log(error);
});
return data;
},
...
}
And calling these functions in app.js
like this:
const custom = require('./custom.js');
app.setHandler({
async EmailSearchIntent() {
const result = custom.email_search_result;
...
}
});
The above approach works fine when testing with JOVO debugger. So I went on to deploy to Alexa using jovo deploy
and got the following error:
Updating Alexa Skill project for ASK profile default
-> Cannot read property ‘uri’ of undefined
Below is the complete console output:
Bundle Project
Copy source code to “./bundle”
Run “npm install --production”
Zip “./bundle” folder
-> Zip path: /var/www/alexa-skills/MarketingMetrics/bundle.zip
❯ Deploying Alexa Skill
Updating Alexa Skill project for ASK profile default
-> Cannot read property ‘uri’ of undefined
Deploying Interaction Model, waiting for build
I searched through the project and only find any occurrence of uri
. Please see below the screenshot of the project-wide search result for uri
.
I apologize for putting on too much of messages. I Googled first and come back here only after not been able to find an answer.