-
Notifications
You must be signed in to change notification settings - Fork 87
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
[Bug]: SNS -> SQS Subscription wrong ARN when working with localstack- Invalid parameter: SQS endpoint ARN #179
Comments
@mj1618 - if no one has ready fix for it in spare time I will propose PR to fox this issue. Will npm publish work on successful PR? |
I have the same issue when using docker
|
@pikos-apikos - for now you can workaround the issue with commenting out your sns subscription // INFO: this has to be commented until https://github.com/mj1618/serverless-offline-sns/issues/180. Not working on serverless-offline
// SnsTestSubscription: {
// Type: 'AWS::SNS::Subscription',
// Properties: {
// Protocol: 'sqs',
// Endpoint: { 'Fn::GetAtt': ['TestQueue', 'Arn'] },
// TopicArn: { Ref: 'SnsTestTopic' },
// RawMessageDelivery: 'true',
// },
// }, And adding subscriptions in your serverless -> custom -> serverless-offline-sns subscriptions: [
{
topic: {
topicName: 'test-topic',
},
queue: `arn:aws:sqs:${process.env.AWS_DEFAULT_REGION}:${process.env.AWS_ACCOUNT_ID}:test-queue`,
},
] My sns-offline setup 'serverless-offline-sns': {
port: 4002,
'sns-endpoint': 'http://localhost:4566',
accountId: process.env.AWS_ACCOUNT_ID,
autoSubscribe: false,
subscriptions: [
{
topic: {
topicName: 'test-topic',
},
queue: `arn:aws:sqs:${process.env.AWS_DEFAULT_REGION}:${process.env.AWS_ACCOUNT_ID}:test-queue`,
},
],
}, |
Bug description
autoSubscribe not working for resource with
Protocol: 'sqs',
Environment
Bugfix or workaround
Make autoSubscribe feature work by providing resource arn in Endpoint: subscribeEndpoint, for Protocol: 'sqs' not http url.
Details
We can make autoSubscribe work for SQS subscriptions with sns-endpoint config option by allowing to pull queue resource ARN.
⚠️ Invalid parameter: SQS endpoint ARN.
Currently when code reaches this.sns.subscribe(params, (err, data) => ... then params object is already wrong. When we provide resource with
Protocol: 'sqs',
line Endpoint: subscribeEndpoint, should not have URL in it. Since mixing protocol different then 'http' and url provided in endpoint will result in error from AW SDKAnd this makes sense since when using Protocol: 'SQS' SDK is expecting ARN not http url.
For serverless.ts configuration:
This code fails
when this code works
And it triggers lambda configured like below in the end
script sending message to SNS
The text was updated successfully, but these errors were encountered: