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
Support all intrinsic functions for SNS definition #3824
Comments
Thanks for opening @timsuchanek 👍 Just dropping a line that the global |
+1 |
2 similar comments
+1 |
+1 |
+1 poked around looks like the type checking in @pmuens would you accept a PR to clean the type checking here up and throw a more meaningful error if a non string topicName is provided? |
any updates? I have to hardcode those arn related things for now. Feels not flexible. |
Is this being investigated ?? |
+1 - any updates on this? |
We're also running into this using hello:
handler: handleHelloTopic
events:
- sns:
arn: {Fn::ImportValue: 'HelloSNSTopicArn'} |
handler: src/handlers/on-demand-extensions/index.extensionCreated
events:
- sns:
arn:
Fn::GetAtt:
- OnDemandExtensionsCreatedTopic
- Arn
topicName:
Fn::Gett:
- OnDemandExtensionsCreatedTopic
- TopicName gives me:
using arn and topicName based off this output:
using |
+1 here. is there a workaround in the interim for this? Using |
@drexler if you're trying to use |
@DavidJFelix thx. |
Still no fix? 😢 |
Any update on this? |
@gaviniflix I found a work around by using the custom section in serverless.yml. I import the arn value from another cloudformation stack there. custom:
snsTopic:
Fn::ImportValue: 'other-cloudformation-stack-${self:provider.stage}:TopicName' and later in the events section I substitute it: events:
- sns:
arn: ${self:custom.snsTopic}
topicName: 'TopicName' It works for me on SLS version 1.32.0, node 8.10.0 . I hope it is helpful for you too. |
@hmshwt I'm using the same version of SLS, node 8.12.0, and that does not work for me. EDIT: As I discovered below, this does in fact work, I was using a non-string value for |
@yahehe Could you please paste the error and the relevant section of the serverless.yml file. |
Serverless:
Error:
|
@yahehe Have you tried adding topicName: 'TopicName' after arn: ${self:custom.snsTopic} ? |
That won't do anything, the way the code is structured will have it fail before it looks at the topic name. I'm working on a fix now |
@yahehe I tried to remove the topicName property and I get the same error as you did
Once I add it back, the deployment is successful. |
@hmshwt ah you know what, I think you might be right. Part of my issue is I was trying to have |
Just figured out, by reading https://github.com/serverless/serverless/blob/master/lib/plugins/aws/package/compile/events/sns/index.js#L32 topicName has to be a string for this to work.
If topicName is from something like Fn::GetAtt, topicName will become an object and trigger https://github.com/serverless/serverless/blob/master/lib/plugins/aws/package/compile/events/sns/index.js#L35, which looks like a bug for me, because why cannot we have both arn and topic name to be object. |
Any updates on this? |
i am also getting this error, here is my serverless.yml
and my resource, section:
produces:
|
@nkhine you need |
Thanks for the forensics on this, it saved us a lot of time. We import the ARN, so providing additional For now, we just set the |
This is a Bug Report
Description
The docs state, that you can use cloudformation intrinsic functions while defining the sns source for a function, however, when I take this example:
and adjust it to ours needs
it returns the following error:
The example how it is in the docs works without problems, but adding the
Fn::GetAtt
makes it fail.Related PR
Additional Data
Your Environment Information
The text was updated successfully, but these errors were encountered: