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

UnhandledPromiseRejectionWarning: The security token included in the request is invalid. #48

Open
juandavidpineda opened this issue Feb 6, 2018 · 1 comment

Comments

@juandavidpineda
Copy link

juandavidpineda commented Feb 6, 2018

Unhandled promise rejection (rejection id: 1): UnrecognizedClientException: The security token included in the request is invalid.

Hi, I try to catch this Exception, but I can't do that.

What should I do in that case, I call the ping method from ES, after that I will return the health for that.

router.route('/health').get(function (req, res, next) {
    let client = ES.Client({
        hosts: [config.elasticSeachUrl],
        connectionClass: require('http-aws-es'),
        awsConfig: new AWS.Config({
            region: config.awsZone
        })
    }).catch((error) => {
        console.log(error)
    });
    client.ping({
            // ping usually has a 3000ms timeout
            requestTimeout: 1000
        })
        .then(() => console.log('finish'))
        .catch((err) => console.log(err));

});

but it always is throwing me the exception but i can't to catch that.

@austince
Copy link

austince commented Sep 3, 2019

I've also seen this when scrolling:

Error: Authorization Exception
at respond (/home/node/app/node_modules/elasticsearch/src/lib/transport.js:308:15)
at checkRespForFailure (/home/node/app/node_modules/elasticsearch/src/lib/transport.js:267:7)
at done (/home/node/app/node_modules/http-aws-es/connector.js:48:7)
at IncomingMessage.cleanUp (/home/node/app/node_modules/http-aws-es/src/node.js:20:7

{
status: 403,
displayName: 'AuthorizationException',
message: 'Authorization Exception',
path: '/_search/scroll',
query: { scroll: '30s' },
body:  { message: 'The security token included in the request is invalid' },
}

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

2 participants