85x14 / griddler-ses

MIT License
13 stars 29 forks source link

Add Rail 5 compatibility #11

Open ccallebs opened 7 years ago

ccallebs commented 7 years ago

This is a PR to address https://github.com/85x14/griddler-ses/issues/10.

Let me know if any changes are required.

apotapov commented 7 years ago

Any chance we can merge this in? Hitting this issue as well.

ccallebs commented 7 years ago

@apotapov I plan on supporting the gem if @85x14 doesn't respond. They don't have any public members.

ccallebs commented 7 years ago

@kmewhort Do you still have access to this repository?

apotapov commented 7 years ago

@ccallebs good stuff. Turns out that the emails we are receiving are often larger than 150kb which is the SES/SNS limit. So I'm going to have to process them through S3 instead of griddler.

If you do take over the development, might be worth reaching out to the folks at griddler to point to your repo instead of this one.

By the way I was seeing an error using the new sns_message.rb:

19:15:07 web.1    | NoMethodError - undefined method `unpack' for nil:NilClass:
19:15:07 web.1    |   /Users/apotapov/.rbenv/versions/2.3.1/lib/ruby/2.3.0/base64.rb:59:in `decode64'
19:15:07 web.1    |    () Users/apotapov/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/griddler-ses-3bc72638c800/lib/aws/sns_message.rb:115:in `decode'
19:15:07 web.1    |    () Users/apotapov/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/griddler-ses-3bc72638c800/lib/aws/sns_message.rb:44:in `authentic?'
19:15:07 web.1    |    () Users/apotapov/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/griddler-ses-3bc72638c800/lib/griddler/ses/adapter.rb:20:in `normalize_params'
19:15:07 web.1    |    () Users/apotapov/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/griddler-ses-3bc72638c800/lib/griddler/ses/adapter.rb:15:in `normalize_params'
19:15:07 web.1    |   griddler (1.4.0) app/controllers/griddler/emails_controller.rb:17:in `normalized_params'
19:15:07 web.1    |   griddler (1.4.0) app/controllers/griddler/emails_controller.rb:3:in `create'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/abstract_controller/base.rb:188:in `process_action'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/callbacks.rb:126:in `call'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/callbacks.rb:455:in `call'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_controller/metal/rescue.rb:20:in `process_action'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `block in instrument'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `instrument'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
19:15:07 web.1    |   activerecord (5.0.0.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
19:15:07 web.1    |   sweet_notifications (1.0.0) lib/sweet_notifications/controller_runtime.rb:21:in `block (2 levels) in controller_runtime'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/abstract_controller/base.rb:126:in `process'
19:15:07 web.1    |   actionview (5.0.0.1) lib/action_view/rendering.rb:30:in `process'
19:15:07 web.1    |   rack-mini-profiler (0.10.1) lib/mini_profiler/profiling_methods.rb:102:in `block in profile_method'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_controller/metal.rb:190:in `dispatch'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_controller/metal.rb:262:in `dispatch'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
19:15:07 web.1    |   rack-pjax (1.0.0) lib/rack/pjax.rb:12:in `call'
19:15:07 web.1    |   bullet (5.1.1) lib/bullet/rack.rb:12:in `call'
19:15:07 web.1    |   rack (2.0.1) lib/rack/deflater.rb:35:in `call'
19:15:07 web.1    |   remotipart (1.3.1) lib/remotipart/middleware.rb:32:in `call'
19:15:07 web.1    |   warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
19:15:07 web.1    |   warden (1.2.6) lib/warden/manager.rb:34:in `call'
19:15:07 web.1    |   rack (2.0.1) lib/rack/etag.rb:25:in `call'
19:15:07 web.1    |   rack (2.0.1) lib/rack/conditional_get.rb:38:in `call'
19:15:07 web.1    |   rack (2.0.1) lib/rack/head.rb:12:in `call'
19:15:07 web.1    |    () Users/apotapov/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/bundler/gems/griddler-ses-3bc72638c800/lib/griddler/ses/middleware.rb:16:in `call'
19:15:07 web.1    |   rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
19:15:07 web.1    |   rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
19:15:07 web.1    |   activerecord (5.0.0.1) lib/active_record/migration.rb:552:in `call'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
19:15:07 web.1    |   rollbar (2.12.0) lib/rollbar/middleware/rails/rollbar.rb:24:in `block in call'
19:15:07 web.1    |   rollbar (2.12.0) lib/rollbar.rb:735:in `scoped'
19:15:07 web.1    |   rollbar (2.12.0) lib/rollbar/middleware/rails/rollbar.rb:22:in `call'
19:15:07 web.1    |   better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
19:15:07 web.1    |   better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
19:15:07 web.1    |   better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
19:15:07 web.1    |   rollbar (2.12.0) lib/rollbar/middleware/rails/show_exceptions.rb:22:in `call_with_rollbar'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
19:15:07 web.1    |   railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
19:15:07 web.1    |   railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
19:15:07 web.1    |   activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
19:15:07 web.1    |   railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
19:15:07 web.1    |   request_store (1.3.1) lib/request_store/middleware.rb:9:in `call'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24:in `call'
19:15:07 web.1    |   rack (2.0.1) lib/rack/method_override.rb:22:in `call'
19:15:07 web.1    |   rack (2.0.1) lib/rack/runtime.rb:22:in `call'
19:15:07 web.1    |   rack-timeout (0.4.2) lib/rack/timeout/core.rb:122:in `block in call'
19:15:07 web.1    |   rack-timeout (0.4.2) lib/rack/timeout/support/timeout.rb:19:in `timeout'
19:15:07 web.1    |   rack-timeout (0.4.2) lib/rack/timeout/core.rb:121:in `call'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
19:15:07 web.1    |   actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
19:15:07 web.1    |   rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
19:15:07 web.1    |   rack-cors (0.4.0) lib/rack/cors.rb:80:in `call'
19:15:07 web.1    |   rack-mini-profiler (0.10.1) lib/mini_profiler/profiler.rb:278:in `call'
19:15:07 web.1    |   railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
19:15:07 web.1    |   puma (3.6.2) lib/puma/configuration.rb:225:in `call'
19:15:07 web.1    |   puma (3.6.2) lib/puma/server.rb:578:in `handle_request'
19:15:07 web.1    |   puma (3.6.2) lib/puma/server.rb:415:in `process_client'
19:15:07 web.1    |   puma (3.6.2) lib/puma/server.rb:275:in `block in run'
19:15:07 web.1    |   puma (3.6.2) lib/puma/thread_pool.rb:116:in `block in spawn_thread'
19:15:07 web.1    |

I'd rather not not share the payload here, but can send over if you like.

mort commented 7 years ago

Thanks a lot for this, @ccallebs

hadees commented 6 years ago

@ccallebs are you still going to maintain this?

ccallebs commented 6 years ago

@hadees Definitely willing to.

hadees commented 6 years ago

@ccallebs looks like you've already got a fork, can you just create a new gem? Then you can contact Griddler and have them link to you. You should also put up a tip thing because I'll be totally willing to buy you a 🍺 and help mantaining this.

I'm not sure @85x14 is ever coming back.

hadees commented 6 years ago

Actually @ccallebs I wonder if @85x14 is even a person. It looks like @kmewhort is the actual author.

ccallebs commented 6 years ago

@hadees Fair point, I can rename the gem. I'll do that this evening!

ccallebs commented 6 years ago

@hadees Would you want to code review the name change over at https://github.com/ccallebs/griddler-ses/pull/2?

kmewhort commented 6 years ago

@ccallebs, just saw this thread after @hadees tagged me a couple days ago. We're not using this approach any more and I unfortunately don't really have the bandwidth to maintain it right now. I just added you as an admin to this repo if you'd want to do so here with the existing name - entirely up to you though!

ccallebs commented 6 years ago

Thanks @kmewhort! I think it's best to keep it here with the existing name. I'll work on merging the changes on my branch and bumping a major version number in process.

hughkolias commented 6 years ago

@ccallebs @kmewhort - updated the reference in Thoughtbot's README to the new forked version... thanks for the hard work!