@@ -225,7 +225,8 @@ module.exports = function(currentTemplate, aliasStackTemplates, currentAliasStac
225
225
const authorizerType = _ . get ( authorizer , 'Properties.Type' ) ;
226
226
if ( authorizerType === 'TOKEN' || authorizerType === 'REQUEST' ) {
227
227
const uriParts = authorizer . Properties . AuthorizerUri [ 'Fn::Join' ] [ 1 ] ;
228
- const funcIndex = _ . findIndex ( uriParts , part => _ . has ( part , 'Fn::GetAtt' ) ) ;
228
+ const funcIndex = _ . findIndex ( uriParts , part =>
229
+ _ . has ( part , 'Fn::GetAtt' ) || ( part . startsWith && part . startsWith ( 'arn:aws:lambda' ) ) ) ;
229
230
230
231
// Use the SERVERLESS_ALIAS stage variable to determine the called function alias
231
232
uriParts . splice ( funcIndex + 1 , 0 , ':${stageVariables.SERVERLESS_ALIAS}' ) ;
@@ -267,7 +268,7 @@ module.exports = function(currentTemplate, aliasStackTemplates, currentAliasStac
267
268
const aliasName = _ . find ( _ . keys ( aliases ) , alias => _ . startsWith ( alias , functionName ) ) ;
268
269
269
270
// Adjust references and alias permissions
270
- permission . Properties . FunctionName = { Ref : aliasName } ;
271
+ permission . Properties . FunctionName = aliasName ? { Ref : aliasName } : permission . Properties . FunctionName ;
271
272
if ( permission . Properties . SourceArn ) {
272
273
// Authorizers do not set the SourceArn property
273
274
permission . Properties . SourceArn = {
@@ -287,7 +288,7 @@ module.exports = function(currentTemplate, aliasStackTemplates, currentAliasStac
287
288
}
288
289
289
290
// Add dependency on function version
290
- permission . DependsOn = [ versionName , aliasName ] ;
291
+ permission . DependsOn = [ versionName , aliasName ] . filter ( name => name ) ;
291
292
292
293
delete stageStack . Resources [ name ] ;
293
294
} ) ;
0 commit comments