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

Conversation

Enase
Copy link
Contributor

@Enase Enase commented Mar 25, 2020

@Enase
Copy link
Contributor Author

Enase commented Mar 25, 2020

@HyperBrain could you merge / release?

Toktik added a commit to Toktik/serverless-aws-alias that referenced this pull request Apr 8, 2020
@lkolchin
Copy link

lkolchin commented Apr 9, 2020

What's the ETA for the fix to be merged?

@chauhm
Copy link

chauhm commented Apr 24, 2020

Sorry
This bug is merged and release with new version?
Currently I'm using serverless-aws-alias and it's effected and occurs error in deploy.

@codezninja
Copy link

can we get this released this week? This seems to be a fix much needed for people to use it with latest serverless versions

@joelmonyx
Copy link

@HyperBrain Can you kindly review the PR please? It'll be great to use this plugin with the latest framework core version.

Much appreciated!

@hyosangAhn
Copy link

I get the error..

Serverless Error ---------------------------------------

Export 'project-name-ServerlessAliasReference' does not exist.

Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com

Your Environment Information ---------------------------
Operating System: win32
Node Version: 12.18.2
Framework Version: 1.74.1
Plugin Version: 3.6.15
SDK Version: 2.3.1
Components Version: 2.31.12

@danielsan
Copy link

How are people creating a new project with this plugin without this patch???
Every single time I create a new serverless project with it and I try to deploy I get this error

@codezninja
Copy link

I don't think anyone is creating new projects with the latest serverless version. Most likely they are locking down the serverless version

@sondreslathia
Copy link

Any news on this issue ? I'm also hitting this problem

@barnabef
Copy link

I am evaluating this plugin for a client and am in a situation where they can't use serverless <=1.62. Merging this fix would be very appreciated.

@@ -82,7 +82,9 @@ module.exports = {
.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.statusCode === 400

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about (to make it easier to understand):

Suggested change
if (err.statusCode === 400
if (
err.statusCode === 400 ||
(
err.statusCode === undefined &&
err.providerError &&
err.providerError.statusCode === 400
)
) {

package.json Outdated
"sinon-chai": "^3.3.0"
"mocha": "^7.1.1",
"nyc": "^15.0.0",
"serverless": "^1.67.0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be an older version of Serverless, should it be updated?

@jefersonlemos
Copy link

Hey, does anyone can approve this merge ?

@siovaneDAZN
Copy link

Any chances of this PR to be approved?

@harazdovskiy
Copy link

@HyperBrain, could you please review/merge this one? Since it's really a bottleneck for projects of mine, we don't want to give up on using this plugin)

@osevostianov
Copy link

@HyperBrain Any updates?...

@Bielik20
Copy link

Bielik20 commented Jan 4, 2021

@Enase Would you consider releasing it as a separate package (serverless-aws-alias-hotfixed)? It has been almost a year and most of us would really appreciate a working version. Thank you in advance.

@Enase
Copy link
Contributor Author

Enase commented Jan 9, 2021

@Bielik20 Feel free to use serverless-aws-alias-fixed

Hope it helps everyone..

@tanmay-kulkarni
Copy link

If this has been fixed, please merge. Would really appreciate it.

@ABRIO-PR
Copy link

@Bielik20 Feel free to use serverless-aws-alias-fixed

Hope it helps everyone..

I have issue with serverless-aws-alias-fixed

TypeError: Cannot read property 'Properties' of undefined

@Enase
Copy link
Contributor Author

Enase commented Jan 18, 2021

@ABRIO-PR Hello!
I didn't add or change any logic that somehow can affect 'Properties' property in this PR. Mb I can help with it, but a way you report the issue doesn't have something to do with software development.

@ABRIO-PR
Copy link

@Enase I set "role" at the provider and it working. But if set role at functions:

TypeError: Cannot read property 'Properties' of undefined
at AwsAlias.module.exports (/home/and/work/serverless/node_modules/serverless-aws-alias-fixed/lib/stackops/lambdaRole.js:38:11)
at AwsAlias.aliasHandleLambdaRole (/home/and/work/serverless/node_modules/serverless-aws-alias-fixed/lib/aliasRestructureStack.js:43:21)
at AwsAlias.tryCatcher (/home/and/work/serverless/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:544:35)
at Promise._settlePromise (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:729:18)
at Promise._fulfill (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:673:18)
at PromiseArray._resolve (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:127:19)
at PromiseArray._promiseFulfilled (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:145:14)
at PromiseArray._iterate (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:115:31)
at PromiseArray.init [as _init] (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:79:10)
at Promise._settlePromise (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:601:21)
at Promise._settlePromise0 (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:729:18)
at Promise._fulfill (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:673:18)
at Promise._resolveCallback (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:489:14)
at Promise._settlePromiseFromHandler (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:559:17)
at Promise._settlePromise (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:729:18)
at Promise._fulfill (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:673:18)
at PromiseArray._resolve (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:127:19)
at PromiseArray._promiseFulfilled (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:145:14)
at PromiseArray._iterate (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:115:31)
at PromiseArray.init [as _init] (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:79:10)
at Promise._settlePromise (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:601:21)
at Promise._settlePromise0 (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:729:18)
at Promise._fulfill (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:673:18)
at Promise._resolveCallback (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:489:14)
at Promise._settlePromiseFromHandler (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:559:17)
at Promise._settlePromise (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:729:18)
at Promise._fulfill (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:673:18)
at PromiseArray._resolve (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:127:19)
at PromiseArray._promiseFulfilled (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:145:14)
at PromiseArray._iterate (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:115:31)
at PromiseArray.init [as _init] (/home/and/work/serverless/node_modules/bluebird/js/release/promise_array.js:79:10)
at Promise._settlePromise (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:601:21)
at Promise._settlePromise0 (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/and/work/serverless/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/home/and/work/serverless/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/home/and/work/serverless/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/and/work/serverless/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/and/work/serverless/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:456:21)
at process.topLevelDomainCallback (domain.js:137:15)

@Enase
Copy link
Contributor Author

Enase commented Jan 18, 2021

@ABRIO-PR Could you provide serverless.yml sample? And pls make sure that it's not a duplicate of #178.
Thanks in advance.

@Enase
Copy link
Contributor Author

Enase commented Jan 18, 2021

@ABRIO-PR I'm not sure will it work or not, but you can try to apply this patch and let us know the result.

fix.patch

Index: lib/stackops/lambdaRole.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/lib/stackops/lambdaRole.js b/lib/stackops/lambdaRole.js
--- a/lib/stackops/lambdaRole.js	(revision eab5d8644d17d8b69ee7215bbbb2eb469bc39e57)
+++ b/lib/stackops/lambdaRole.js	(date 1610985200900)
@@ -34,13 +34,15 @@
 	const roleLogicalId = `IamRoleLambdaExecution${normalizedAlias}`;
 	const role = stageStack.Resources.IamRoleLambdaExecution;
 
-	// Set role name
-	if (role.Properties.RoleName['Fn::Join']) {
-		_.last(role.Properties.RoleName['Fn::Join']).push(this._alias);
-	}
+	if (role) {
+		// Set role name
+		if (role.Properties.RoleName['Fn::Join']) {
+			_.last(role.Properties.RoleName['Fn::Join']).push(this._alias);
+		}
 
-	stageStack.Resources[roleLogicalId] = stageStack.Resources.IamRoleLambdaExecution;
-	delete stageStack.Resources.IamRoleLambdaExecution;
+		stageStack.Resources[roleLogicalId] = stageStack.Resources.IamRoleLambdaExecution;
+		delete stageStack.Resources.IamRoleLambdaExecution;
+	}
 
 	// Replace references
 	const functions = _.filter(stageStack.Resources, ['Type', 'AWS::Lambda::Function']);

Abhijith-Nagaraja added a commit to Abhijith-Nagaraja/serverless-aws-alias that referenced this pull request Feb 5, 2021
This is an inspiration from the fix that @Enase provided long back and not merged.
Tested in my local setup and works.

Fixes issue serverless-heaven#186 and serverless-heaven#200
Abhijith-Nagaraja added a commit to Abhijith-Nagaraja/serverless-aws-alias that referenced this pull request Feb 5, 2021
This is an inspiration from the fix that @Enase provided long back and not merged.
Tested in my local setup and works.

Fixes issue serverless-heaven#186 and serverless-heaven#200
@Abhijith-Nagaraja
Copy link

Created a separate PR for this with only needed change #201

@dnascimento
Copy link

@HyperBrain could this be merged? HyperBrain seems inactive in git over the last 2 years... Should we fork this plugin to a new repo?

@saschabraun
Copy link

Can someone review and merge this please?

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

Successfully merging this pull request may close these issues.

ServerlessError: Export 'project-name-ServerlessAliasReference' does not exist.