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

ensureValidToken does NOT invoke the success callback in all cases #192

Open
karsov-aiops opened this issue Dec 4, 2020 · 0 comments · May be fixed by #193
Open

ensureValidToken does NOT invoke the success callback in all cases #192

karsov-aiops opened this issue Dec 4, 2020 · 0 comments · May be fixed by #193

Comments

@karsov-aiops
Copy link

Hello,

I am using the following code to upload a code version within a grunt task:

const sfcc = require('sfcc-ci');
const util = require('util');

const sfccAuth = util.promisify(sfcc.auth.auth);
const sfccCodeDeploy = util.promisify(sfcc.code.deploy);

const asyncDone = this.async();

let accessToken = null;
sfccAuth(clientId, clientSecret)
    .then(token => {
        accessToken = token;

        const deployOptions = {};

        return sfccCodeDeploy(host, options.archive, accessToken, deployOptions);
    })
    .catch(asyncDone)
    .finally(asyncDone);

The first step: Getting a valid token works as expected (if the client_id and the client_secret are correct a token is returned, otherwise it fails to the .catch())

However if the client_Id is not configured in the BM WebDav settings the following error appears:

Error: WebDAV authentication failed. Please (re-)authenticate first by running ´sfcc-ci auth:login´ or ´sfcc-ci client:auth´. No token auto-renewal is performed. If the problem still occurs please check the WebDAV Client Permissions on the instance and ensure your client ID has been granted access to required WebDAV resources.

which comes from: sfcc-ci/lib/ocapi.js:75~ensureValidToken

The problem is that ensureValidToken ONLY logs the error but DOES NOT call the callback with an error (which I can handle in my Promise chain)

karsov-aiops added a commit to karsov-aiops/sfcc-ci that referenced this issue Dec 4, 2020
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

Successfully merging a pull request may close this issue.

1 participant