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

Fix: Export 'project-name-ServerlessAliasReference' does not exist. #186

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ rules:
linebreak-style:
- error
- unix
no-trailing-spaces: error
semi:
- error
- always
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Serverless AWS alias plugin

**The plugin requires Serverless 1.12 or later!**
**The plugin requires Serverless ver. 2!**

This plugin enables use of AWS aliases on Lambda functions. The term alias must not
be mistaken as the stage. Aliases can be deployed to stages, e.g. if you work on
Expand Down
6 changes: 3 additions & 3 deletions lib/deferredOutputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ module.exports = {

/**
* Register a deferred output
* @param {string} sourceOutput
* @param {Object} targetObject
* @param {string} targetPropertyName
* @param {string} sourceOutput
* @param {Object} targetObject
* @param {string} targetPropertyName
*/
addDeferredOutput(sourceOutput, targetObject, targetPropertyName) {
this.options.verbose && this.serverless.cli.log(`Register deferred output ${sourceOutput} -> ${targetPropertyName}`);
Expand Down
2 changes: 1 addition & 1 deletion lib/removeAlias.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ module.exports = {
this._serverless.cli.log('noDeploy option active - will do nothing');
return BbPromise.resolve();
}

this._masterAlias = currentTemplate.Outputs.MasterAliasName.Value;
if (this._stage && this._masterAlias === this._alias) {
// Removal of the master alias is requested -> check if any other aliases are still deployed.
Expand Down
15 changes: 11 additions & 4 deletions lib/stackInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,17 @@ module.exports = {
aliasStackLoadAliasTemplates() {

return this.aliasStackGetAliasStackNames() // eslint-disable-line lodash/prefer-lodash-method
.mapSeries(stack => BbPromise.join(BbPromise.resolve(stack), this.aliasStackLoadTemplate(stack)))
.map(stackInfo => ({ stack: stackInfo[0], template: stackInfo[1] }))
.then((nameList) => {
return Promise.all(nameList.map((stack) => {
return BbPromise.join(BbPromise.resolve(stack), this.aliasStackLoadTemplate(stack));
}));
}).then((stackInfoList) => {
return stackInfoList.map(stackInfo => ({ stack: stackInfo[0], template: stackInfo[1] }))
})
// .mapSeries(stack => BbPromise.join(BbPromise.resolve(stack), this.aliasStackLoadTemplate(stack)))
// .map(stackInfo => ({ stack: stackInfo[0], template: stackInfo[1] }))
.catch(err => {
if (err.statusCode === 400) {
if (err.providerError && err.providerError.statusCode === 400) {
// The export is not yet there. Can happen on the very first alias stack deployment.
return BbPromise.resolve([]);
}
Expand Down Expand Up @@ -176,7 +183,7 @@ module.exports = {

const currentAliasStackTemplate = _.get(_.first(removed), 'template', {});
const deployedAliasStackTemplates = _.map(filteredAliasStackTemplates, template => template.template);

this._serverless.service.provider.deployedCloudFormationTemplate = currentTemplate;
this._serverless.service.provider.deployedCloudFormationAliasTemplate = currentAliasStackTemplate;
this._serverless.service.provider.deployedAliasTemplates = filteredAliasStackTemplates;
Expand Down
Loading