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

Invalid tag when deploying masterAlias #191

Open
kortac opened this issue May 11, 2020 · 4 comments
Open

Invalid tag when deploying masterAlias #191

kortac opened this issue May 11, 2020 · 4 comments

Comments

@kortac
Copy link

kortac commented May 11, 2020

When deploying masterAlias with command

SLS_DEBUG=* sls deploy --verbose --masterAlias

it fails with the following error:

ServerlessError: Expected params.Tags[1].Value to be a string
      at /Users/***/WebstormProjects/***/node_modules/serverless/lib/plugins/aws/provider/awsProvider.js:327:27
      at runMicrotasks (<anonymous>)
      at processTicksAndRejections (internal/process/task_queues.js:94:5)

Reason for this is because serverless-aws-alias tries to add a tag with a boolean value:

Serverless: [AWS cloudformation undefined 0.004s 0 retries] createStack({
  StackName: '***',
  OnFailure: 'DELETE',
  Capabilities: [ 'CAPABILITY_IAM', 'CAPABILITY_NAMED_IAM', [length]: 2 ],
  Parameters: [ [length]: 0 ],
  TemplateBody: '{"AWSTemplateFormatVersion":"2010-09-09","Description":"Alias stack for *** (true)","Resources":{"ServerlessAliasLogGroup":{"Type":"AWS::Logs::LogGroup","Properties":{"LogGroupName":"/serverless/***-true","RetentionInDays":7}}},"Outputs":{"ServerlessAliasName":{"Description":"Alias the stack represents.","Value":"true"},"ServerlessAliasLogGroup":{"Description":"Log group for alias.","Value":{"Ref":"ServerlessAliasLogGroup"},"Export":{"Name":"***-true-LogGroup"}}}}',
  Tags: [
    { Key: 'STAGE', Value: 'production' },
    { Key: 'ALIAS', Value: true },
    [length]: 2
  ]
})

Versions:
serverless 1.61.2
serverless-aws-alias 1.8.0
serverless-domain-manager 4.0.0

@kortac
Copy link
Author

kortac commented May 11, 2020

Applying this patch file fixes the error:

diff --git a/node_modules/serverless-aws-alias/lib/createAliasStack.js b/node_modules/serverless-aws-alias/lib/createAliasStack.js
index adadc43..2a674f0 100644
--- a/node_modules/serverless-aws-alias/lib/createAliasStack.js
+++ b/node_modules/serverless-aws-alias/lib/createAliasStack.js
@@ -16,7 +16,7 @@ module.exports = {
 
 		this._serverless.cli.log(`Creating Alias Stack '${this._alias}' ...`);
 		const stackName = `${this._provider.naming.getStackName()}-${this._alias}`;
-		let stackTags = { STAGE: this._options.stage, ALIAS: this._alias };
+		let stackTags = { STAGE: this._options.stage, ALIAS: this._alias.toString() };
 
 		// Merge additional stack tags
 		if (_.isObject(this._serverless.service.provider.stackTags)) {
diff --git a/node_modules/serverless-aws-alias/lib/updateAliasStack.js b/node_modules/serverless-aws-alias/lib/updateAliasStack.js
index 15e7ec2..76b0c80 100644
--- a/node_modules/serverless-aws-alias/lib/updateAliasStack.js
+++ b/node_modules/serverless-aws-alias/lib/updateAliasStack.js
@@ -13,7 +13,7 @@ module.exports = {
 		this._serverless.cli.log('Creating alias stack...');
 
 		const stackName = `${this._provider.naming.getStackName()}-${this._alias}`;
-		let stackTags = { STAGE: this._options.stage, ALIAS: this._alias };
+		let stackTags = { STAGE: this._options.stage, ALIAS: this._alias.toString() };
 		const templateUrl = `https://s3.amazonaws.com/${this.bucketName}/${this._serverless.service.package.artifactDirectoryName}/compiled-cloudformation-template-alias.json`;
 		// Merge additional stack tags
 		if (_.isObject(this._serverless.service.provider.stackTags)) {
@@ -49,7 +49,7 @@ module.exports = {
 
 		this.serverless.cli.log('Updating alias stack...');
 		const stackName = `${this._provider.naming.getStackName()}-${this._alias}`;
-		let stackTags = { STAGE: this._options.stage, ALIAS: this._alias };
+		let stackTags = { STAGE: this._options.stage, ALIAS: this._alias.toString() };
 
 		// Merge additional stack tags
 		if (_.isObject(this._serverless.service.provider.stackTags)) {

@m0ai
Copy link

m0ai commented Jun 3, 2020

I got the same issues too on serverless-aws-alias 1.8.0. think this bug will affect not only me and issues writer but also many users using 1.8.0 version. 😭

@m0ai
Copy link

m0ai commented Jun 3, 2020

@SpaceHeroGuide, how thinking about considering opening a pull request for it?

@njdullea
Copy link

Same issue

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

No branches or pull requests

3 participants