Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ews.run() taking too long to return response. #101

Closed
utkarsh13 opened this issue Oct 6, 2018 · 0 comments
Closed

ews.run() taking too long to return response. #101

utkarsh13 opened this issue Oct 6, 2018 · 0 comments

Comments

@utkarsh13
Copy link

utkarsh13 commented Oct 6, 2018

I am building an Alexa Skill which needs to fetch data from exchange server.
When ews.run() is called from aws lambda, it takes too long to return response which leads to timeout of alexa.
But when I call ews.run() from local machine, it returns response in about 1s.

Here is my code:

app.intent('SetOOO', {
    slots: {},
    utterances: ['set me as out of office today']
}, (req, res) => {
    return oofSetting.setOof().then((result) => {
        console.log("utkarsh" + result);
        res.say("Out of office setting saved successfully.");
    });
// exchange server connection info
const ewsConfig = {
    username: pass.userpass.user,
    password: pass.userpass.pass,
    host: pass.userpass.host,
    temp:__dirname+'\\WSDL'
};

// initialize node-ews
const ews = new EWS(ewsConfig);

// define ews api function
const ewsFunction = 'SetUserOofSettings';

// define ews api function args
const ewsArgs = {
    'Mailbox': {
        'Address': pass.userpass.email
    },
    'UserOofSettings': {
        OofState: 'Enabled',
        ExternalAudience: 'All',
        Duration: {
            StartTime: moment().startOf('day').format(),
            EndTime: moment().endOf('day').format()
        },
        InternalReply: {
            Message:'I am out of office today. Contact my manager for anything urgent.'
        },
        ExternalReply: {
            Message:'I am out of office today. Contact my manager for anything urgent.'
        }
    }
};
module.exports = {
    setOof: function() {
        console.log("utkarsh" + "setOof");
        return ews.run(ewsFunction, ewsArgs)
            .then((result) => {
                console.log("utkarsh" + JSON.stringify(result));
                return result;
            })
            .catch((err) => {
                console.log("utkarsh" + err.message);
            });
    }
};

Can someone tell me if I am doing anything wrong.

EDIT: Looks like there is an issue in opening .wsdl file while creating client from soap module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant