Closed sveredyuk closed 3 years ago
Hi, @sveredyuk .
You need to add this to your application configuration (e.g. development config):
# config/environments/development.rb
config.hosts << 'abcabc123123.ngrok.io'
(Replace "abcabc123123" with your ngrok host).
This should fix your issue. Annoyingly, Rails does not give you any error output at all when this issue occurs so it is difficult to debug.
If you would like to submit a PR for the README that would definitely be appreciated, and blog posts are of course always welcome. : )
Let me know if the above doesn't solve your issue.
Thanks, @bobf. At the end of this journey, I want to do step by step tutorial with screenshots.
@sveredyuk That would be great ! If you have any more issues just let me know; I'm closing this ticket for now.
@bobf Sure, thanks for the useful advice
Do I need to look into a special place for SNS confirmation URL?
On request confirmation In rails logs I got only:
Started POST "/rails/action_mailbox/amazon/inbound_emails" for 54.240.230.184 at 2021-04-20 13:42:12 +0300
Processing by ActionMailbox::Ingresses::Amazon::InboundEmailsController#create as HTML
Filter chain halted as :confirm_subscription rendered or redirected
Completed 200 OK in 2064ms (ActiveRecord: 0.0ms | Allocations: 1898)
@sveredyuk I don't quite understand the question but notice you have this in your logs:
Filter chain halted as :confirm_subscription rendered or redirected
This means that the ARN for the subscription is not recognised - you will need to add it to your application config, e.g.:
# config/environments/production.rb
config.action_mailbox.amazon.subscribed_topics = %w(
arn:aws:sns:eu-west-1:123456789001:example-topic-1
arn:aws:sns:us-east-1:123456789002:example-topic-2
)
Does that answer your question ?
Thanks @bobf for suggestion but I have topics:
Rails.application.config.action_mailbox.amazon.subscribed_topics # =>
["arn:aws:sns:us-west-2:123456789000:sync-requests"]
@sveredyuk Aha, in that case I think everything is working - this just means that the subscription request was confirmed, I think ! So you should be able to start receiving emails.
What event triggered this post request ? Did you click "Request confirmation" ? If you clicked that, and then saw this in your logs, it means that the SNS topic has now been confirmed with AWS and so AWS will now start sending notifications to your endpoint.
@bobf Yeah. AWS cache just not shows confirmation status immediately. Thanks
For users, who are still facing the issue, refer to this post
https://stackoverflow.com/questions/46947548/ngrok-not-passing-my-post-request-on-to-localhost
ngrok http -host-header=rewrite localhost:58533
Thanks for maintaining this lib as I just need amazon ses for rails inbound emails and it's awesome that you support removed form rails action mailbox ses support.
But unfortunately, I have some troubles with setup ses + sns + action mailbox. With ngrok I exposed public endpoint to my local machine but all requests to
POST /rails/action_mailbox/amazon/inbound_emails
Respond with:
403 Forbidden
Cors is * for all origins and request types.
Any suggestions? Maybe on resolving this task I can extend your README or write a blog post. Thanks