!Join seems to be broken when using AWS::Lambda::Permission for Api Gateway
See original GitHub issueAre you certain it’s a bug?
- Yes, it looks like a bug
Is the issue caused by a plugin?
- It is not a plugin issue
Are you using the latest version?
- Yes, I’m using the latest version
Is there an existing issue for this?
- I have searched existing issues, it hasn’t been reported yet
Issue description
I’m not using any plugins.
Reproduction Repo: https://github.com/Schachte/ServerlessLambdaSetup
RetrieveAllSubscribersLambdaPermissionApiGateway:
Type: 'AWS::Lambda::Permission'
Properties:
FunctionName: { "Fn::GetAtt": [ RetrieveAllSubscribersLambdaFunction, Arn ] }
Action: lambda:InvokeFunction
Principal: apigateway.amazonaws.com
SourceArn:
Fn::Join:
- ""
- - "helloworld"
- "*"
The output is the following:
An error occurred: RetrieveAllSubscribersLambdaPermissionApiGateway - 1 validation error detected: Value 'helloworld*:execute-api:us-west-2:185871347164:a53ihjk9/*/*' at 'sourceArn' failed to satisfy constraint: Member must satisfy regular expression pattern: arn:(aws[a-zA-Z0-9-]*):([a-zA-Z0-9\-])+:([a-z]{2}((-gov)|(-iso(b?)))?-[a-z]+-\d{1})?:(\d{12})?:(.*) (Service: AWSLambda; Status Code: 400; Error Code: ValidationException; Request ID: 0646f60d41f; Proxy: null).
My question is, how is it possible for the random data in the error to still show up in the SourceArn
if I only joined together the two strings above?
It seems like the join function in this case is making some assumption on what else should be injected in the value? Ideally, I just wanted to interpolate the logical id from a raw !Ref ApiGatewayRestApi
Service configuration (serverless.yml) content
Will post if necessary
Command name and used flags
sls deploy
Command output
See above
Environment information
Operating System: darwin
Node Version: 17.3.0
Framework Version: 2.71.0 (local)
Plugin Version: 5.5.3
SDK Version: 4.3.0
Components Version: 3.18.1
Issue Analytics
- State:
- Created 2 years ago
- Comments:22
Top Results From Across the Web
Resolve API Gateway HTTP API Lambda integration errors
How do I troubleshoot permissions errors from API Gateway HTTP APIs with an AWS Lambda integration or Lambda authorizer?
Read more >What's broken when deploying Lambda and API Gateway via ...
It creates a permission which allows API Gateway to execute your Lambda function. When creating API Gateway with Lambda integration via ...
Read more >Join in Serverless Framework is broken - Stack Overflow
If I hardcode the sourceArn, it works fine. The challenge is interpolating the api gateway id into the string. 6 hours into debugging...
Read more >AWS API Gateway Invoke Lambda Function Permission
API Gateway endpoint can't invoke Lambda with 5XX permission error. ... Select Integration Request item and the following menu will appear.
Read more >Integrating the Curity Identity Server with AWS API Gateway ...
This how-to will cover how to configure the Curity Identity Server to send a partial token or a split token to a configured...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah, that would make sense. I thought overriding the resource name in the other file would take precedence, but I must have been wrong. Ok, good to know. Looks like online there are some pretty weird behaviors using
!sub
and the${}
syntax in certain scenarios as well, so I can stick tojoin
and the plugin, but was wondering why I was having such a hard time. Thanks again!@Schachte I’m glad I could help 😃 Until the next one (hopefully not 😆 ) 🍻