Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!config) {
logError('Internal Error');
process.exit(1);
return;
}
debug('Deploy Config %P', config);
checkConfigForCredentials(config);
printConfigInfo(config);
const spinner = getOraSpinner('Deploying Function').start();
try {
const client = new TwilioServerlessApiClient(config);
client.on('status-update', evt => {
spinner.text = evt.message + '\n';
});
const result = await client.deployLocalProject(config);
spinner.text = 'Serverless project successfully deployed\n';
spinner.succeed();
printDeployedResources(config, result);
const { serviceSid, buildSid } = result;
await saveLatestDeploymentData(
config.cwd,
serviceSid,
buildSid,
config.accountSid.startsWith('AC')
? config.accountSid
: externalCliOptions && externalCliOptions.accountSid
);
process.exit(1);
return;
}
checkConfigForCredentials(config);
printActivateConfig(config);
const details = config.buildSid
? `(${config.buildSid})`
: `from ${config.sourceEnvironment}`;
const spinner = getOraSpinner(
`Activating build ${details} to ${config.targetEnvironment || 'production'}`
).start();
try {
const client = new TwilioServerlessApiClient(config);
const result = await client.activateBuild(config);
spinner.succeed(
`Activated new build ${details} on ${config.targetEnvironment ||
'production'}`
);
printActivateResult(result);
} catch (err) {
handleError(err, spinner);
}
}
if (!config) {
logError('Internal Error');
process.exit(1);
return;
}
checkConfigForCredentials(config);
if (config.types !== 'services' && config.types[0] !== 'services') {
const command = getFullCommand(flags);
checkForValidServiceSid(command, config.serviceSid);
}
try {
const client = new TwilioServerlessApiClient(config);
const result = await client.list({ ...config });
printListResult(result, config);
} catch (err) {
handleError(err);
}
}