SalesforceCommerceCloud / sfcc-ci

Salesforce Commerce Cloud CLI
https://npmjs.com/package/sfcc-ci
BSD 3-Clause "New" or "Revised" License
231 stars 93 forks source link

Javascript API: Code Version activation not triggering #161

Open dmersiowsky opened 4 years ago

dmersiowsky commented 4 years ago

Code activation through the Javascript API does not seem to trigger while the callback doesn't get an error.

Calling this API:

let codeApi = require('sfcc-ci').code;
codeApi.activate(instance, version, token, function (error) { /*error is empty*/ });
dmersiowsky commented 4 years ago

Looks like sfcc-ci is throwing an error itself:

Error: null
    at XXXX/node_modules/sfcc-ci/lib/code.js:425:26
    at Object.ensureValidToken (XXXX/node_modules/sfcc-ci/lib/ocapi.js:94:9)
    at Request._callback (/Users/dmersiowsky/source/build-suite-dev/build/node_modules/sfcc-ci/lib/code.js:414:19)
    at Request.self.callback (XXXX/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.<anonymous> (XXXX/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:198:13)
    at IncomingMessage.<anonymous> (XXXX/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:286:20)
    at IncomingMessage.emit (events.js:203:15)
tobiaslohr commented 4 years ago

while the callback doesn't get an error.

@dmersiowsky can you verify, if you are running into either https://github.com/SalesforceCommerceCloud/sfcc-ci/blob/master/lib/code.js#L415 or https://github.com/SalesforceCommerceCloud/sfcc-ci/blob/master/lib/code.js#L419 condition? In that case, the callback does not get an Error passed

dmersiowsky commented 4 years ago

Didn't debug through that yet but I can confirm that the code version is not yet active and it doesn't get activated either. Instead I can see the stack trace posted above. I already triple-checked the function parameters and they are definitely valid (including the token).

dmersiowsky commented 4 years ago

Looks like we're calling new Error(null) in https://github.com/SalesforceCommerceCloud/sfcc-ci/blob/master/lib/code.js#L425.

I'll investigate.

C-Lacerda commented 3 years ago

H @dmersiowsky have you solved?