fix: #1973 deploy fails with unhelpful error message when service name is not a valid CF stack name

This commit is contained in:
zorrofox 2016-09-23 23:59:13 +08:00
parent dbeaa54832
commit b8e5bb4eca

View File

@ -32,7 +32,7 @@ module.exports = {
createStack() {
const stackName = `${this.serverless.service.service}-${this.options.stage}`;
if (/^[a-zA-Z1-9-]+/.test(stackName) || stackName.length > 128){
if (/^[^a-zA-Z].+|.*[^a-zA-Z0-9\-].*/.test(stackName) || stackName.length > 128){
const errorMessage = [
'The stack name "' + stackName + '" is not quallify. ',
'A stack name can contain only alphanumeric',