Skip to content
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

Get the eventSourceArn from $snsRecord->getTopicArn instead of getEve… #87

Merged
merged 1 commit into from
Jun 17, 2024
Merged

Get the eventSourceArn from $snsRecord->getTopicArn instead of getEve… #87

merged 1 commit into from
Jun 17, 2024

Conversation

SinaFetrat
Copy link

@SinaFetrat SinaFetrat commented Jun 14, 2024

Hi,

While trying to consume SNS events, I encountered the error No transport found for eventSource in \Bref\Symfony\Messenger\Service\MessengerTransportConfiguration. Upon investigation, I discovered that the $eventSourceArn passed to the provideTransportFromEventSource method includes a MessageId, resulting in an ARN like sns://arn:aws:sns:eu-central-1:account-id:sns-topic-name:9d572d5f-a88c-49df-9f61-81270fdb55fc.

Since each event has a different MessageId, this always triggers the No transport found for eventSource error.

This PR addresses the issue by using $snsRecord->getTopicArn() instead of $snsRecord->getEventSubscriptionArn().

@mnapoli. I would greatly appreciate it if you could review this PR, as this issue is a blocker for consuming SNS events in our project.

@mnapoli
Copy link
Member

mnapoli commented Jun 17, 2024

Are you saying using SNS does not work at all? I'm surprised no-one else reported that before. It would be great to have confirmation from someone that this helps.

Have you tried this fix in production? Is it working?

@SinaFetrat
Copy link
Author

SinaFetrat commented Jun 17, 2024

Yes, it is true I guess 🙂
I tested the fix using my branch and it works as expected in our staging environment

I think the reason no one else has experienced this issue is that the file containing the bug was introduced in this PR: #84, and probably not many users have used this functionality since then, and all previous usages have the $transportName passed to the \Bref\Symfony\Messenger\Service\Sns\SnsConsumer or \Bref\Symfony\Messenger\Service\Sqs\SqsConsumer.

P.S: it worked perfectly for SQS events though 🙂

@mnapoli
Copy link
Member

mnapoli commented Jun 17, 2024

Oh good point, thanks! Let's merge then.

@mnapoli mnapoli merged commit 78de6f8 into brefphp:master Jun 17, 2024
5 checks passed
@SinaFetrat SinaFetrat deleted the fix-no-transport-found-error-for-sns-event-source branch June 18, 2024 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants