Closed HyperBrain closed 7 years ago
Locally ESLint as well as the testsuite passes. Will have to check why Travis fails.
Had to upgrade eslint and the testsuite. However unit tests for the normalized roles are yet missing.
@mbruning24 @arabold - Could you do a test with HyperBrain/serverless-aws-alias#normalize-role-name
and check if aliases that include dashes work now?
@HyperBrain sorry it's been a hectic couple weeks. I tested this out. Error looks great BTW!
However, I found a HUGE bummer. API Gateway doesn't allow hyphens in the stage name! What a joke! I mean, come on AWS, it's a URL for crying out loud... The regex for that is /a-zA-Z0-9_/, so underscores are allowed by APIG, but ironically not by the regex! Maybe just switch that bad boy from hyphen to underscore and you'll have really done all you can. Hopefully AWS lets hyphens in stage names sometime in the future.
Edit: Here's my sls output:
$ sls deploy --alias GTWY-123
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Preparing alias ...
Serverless: Creating Alias Stack 'GTWY-123' ...
Serverless: Checking Stack create progress...
.....
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Uploading service .zip file to S3 (165.39 KB)...
Serverless: Uploading CloudFormation alias file to S3...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
........
Serverless: Stack update finished...
Serverless: Updating alias stack...
Serverless: Checking Stack update progress...
.............
Serverless: Operation failed!
Serverless Error ---------------------------------------
An error occurred: ApiGatewayStage - Stage name only allows a-zA-Z0-9_.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: win32
Node Version: 6.11.3
Serverless Version: 1.23.0
Edit 2: Found this error when trying to use an underscore
$ sls deploy --alias GTWY_123
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Preparing alias ...
Serverless Error ---------------------------------------
The stack alias name "ens-alias-dev-GTWY_123" is not valid. A service name should only contain alphanumeric (case sensitive) and hyphens. It should start with an alphabetic character and shouldn't exceed 128 characters.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Forums: forum.serverless.com
Chat: gitter.im/serverless/serverless
Your Environment Information -----------------------------
OS: win32
Node Version: 6.11.3
Serverless Version: 1.23.0
@mbruning24 That's indeed ridiculous. I'll add a light normalization to the stage name creation which only will transform the hyphen as you proposed.
However I have to add that to the docs, because having both aliases my-alias
and my_alias
would lead to a clash then. Maybe we should even emit a warning in case -
or _
are used in an alias.
The hyphen issue on AWS side would imo justify to open a issue/case on their side. Stage names should comply with the official URL rules.
@HyperBrain I've opened a support case with AWS in our company account. For now, I'd be happy with just underscore though, if you wouldn't mind changing that.
No problem. Will do.
Mark Bruning notifications@github.com schrieb am Fr., 3. Nov. 2017, 8:05 nachm.:
@HyperBrain https://github.com/hyperbrain I've opened a support case with AWS in our company account. For now, I'd be happy with just underscore though, if you wouldn't mind changing that.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/HyperBrain/serverless-aws-alias/pull/77#issuecomment-341798360, or mute the thread https://github.com/notifications/unsubscribe-auth/AFRM3nTEB8osjCBkYqc2nGGHelxV50ZSks5sy2PxgaJpZM4QKTQf .
@mbruning24 Sorry for the delay. Now, for stage names the hyphens are replaced by underscores.
Did you get any valuable feedback from AWS yet?
Fixes #68
Aliases can now include characters matching
[a-zA-Z0-9\-+_]+
. To generate a valid role logical id for the alias, the alias name is normalized by using the following table:This should work as it is highly unlikely that someone uses one of the replacement strings in real alias names.