agiledigital / serverless-sns-sqs-lambda

serverless plugin to make serverless-sns-sqs-lambda events
Apache License 2.0
81 stars 18 forks source link

Missing `hashQueueName` option #721

Closed ryanwalters closed 1 year ago

ryanwalters commented 1 year ago

Our CI is failing with the following error:

Generated queue name [really-long-queue-name] is longer than 80 characters long and may be truncated by AWS, causing naming collisions. Try a shorter prefix or name, or try the hashQueueName config option.

However, I don't see this option in the documentation or in the source code. Does this option need to be configured somewhere outside of this plugin?

NoxHarmonium commented 1 year ago

Hi @ryanwalters,

That is actually a typo, we need to get that fixed.

See also: https://github.com/agiledigital/serverless-sns-sqs-lambda/pull/552#issuecomment-1125908306

We recommend using the omitPhysicalId config option to solve that problem. From the README:

AWS allows you to omit the physical ID (queue name) for SQS resources.

In this case, the name is automatically generated by AWS based on the logical ID (the CloudFormation resource name).

This provides some benefits such as the ability to perform updates that require replacement, and not having to worry about the 80 character maximum length for queue names.

However, if you need to refer to the queue by name (which should be rare), rather than a CloudFormation reference, you might have to switch this off so that the name is stable.

https://github.com/agiledigital/serverless-sns-sqs-lambda#what-is-the-omitphysicalid-option

Let me know if enabling that solves your problem. Be careful enabling it for existing stacks if you're referring to queues by name, rather than by CloudFormation reference.

If not, we do have an open PR to enable hashing, which we could have another look at, but I think it would have the same drawbacks to omitPhysicalId in that you couldn't refer to a queue by name anyway.

https://github.com/agiledigital/serverless-sns-sqs-lambda/pull/570

ryanwalters commented 1 year ago

Thanks @NoxHarmonium, enabling that option fixed our issue.