Skip to content

Commit b2ca05a

Browse files
committed
Invalid environment bug fixed for publishing
1 parent d9ba071 commit b2ca05a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/publish.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,21 +214,22 @@ Publish.prototype.init = function() {
214214
headers.authtoken = authtoken;
215215
// get environment names from Contentstack
216216
return request({
217-
uri: `${api.host}/${api.version}${api.urls.environments}?$in=${inputs.environment.toString()}`,
217+
uri: `${api.host}/${api.version}${api.urls.environments}${inputs.environment}`,
218218
headers: headers,
219219
method: 'GET',
220220
json: true
221-
}, function(error, body) {
222-
if (error) {
223-
return cb(error);
221+
}, function(err, body) {
222+
if (err) {
223+
return cb(err);
224224
} else if (body.environments && body.environments.length) {
225+
log(info(JSON.stringify(body)));
225226
inputs.environment_ids = _.map(body.environments, 'uid');
226-
return cb(null, null);
227+
return cb(null);
227228
}
228229
return cb(body);
229230
});
230231
},
231-
function(environments, cb) {
232+
function(cb) {
232233
//checking the mode of publishing content_types/assets/both
233234
switch (inputs.type) {
234235
case 'content_types':
@@ -250,7 +251,7 @@ Publish.prototype.init = function() {
250251
}
251252
], function(err) {
252253
if (err) {
253-
log(error(`Errorred in bulk ${inputs.event}ing on ${inputs.environment} environment.`));
254+
log(error(`Errorred in bulk ${inputs.event}ing on ${inputs.environment} environment due to\n${err.message || JSON.stringify(err)}`));
254255
process.exit(1);
255256
}
256257
log(success(`Bulk ${inputs.event}ing finished on ${inputs.environment} environment.`));

0 commit comments

Comments
 (0)