expo-server-sdk-ruby icon indicating copy to clipboard operation
expo-server-sdk-ruby copied to clipboard

Posting notifications gives you ssl peer check failed error

Open Aryk opened this issue 4 years ago • 4 comments

This started happening out of the blue and my notifications stopped working on production (Im using AWS).

Adding ssl_verifypeer: false fixed the issue (or '-k' option in curl).

Not sure if you guys experienced this too, but here is my solution.

 class TyphoeusNoSSLCheck
      # @aryk - The push notifications just stopped out of nowhere because they expo servers changed something with their ssl
      # certificates (I think) which caused the notifications to not get sent. After some debugging I used the "-k" option on curl
      # or ssl_verifypeer: false option in this library. This is only required when the calls are made from AWS.
      def self.post(*args)
        options = args.last.is_a?(Hash) ? args.pop : {}
        Typhoeus.post(*args, **options, ssl_verifypeer: false)
      end
    end

Aryk avatar Oct 01 '21 19:10 Aryk

Sorry, but how is this used in your workflow? I'm doing something like

client = Exponent::Push::Client.new
...
...
client.send_messages messages

Is your code supposed to monkeypatch Typhoeus?

asanger avatar Oct 12 '21 19:10 asanger

No monkey patching required:

     def client
        @client ||= Exponent::Push::Client.new(http_client: TyphoeusNoSSLCheck)
      end

Aryk avatar Oct 12 '21 20:10 Aryk

ah, lovely. Thank you!

asanger avatar Oct 12 '21 20:10 asanger

@asanger FYI I made a fork that allows to easily add the nossl check without needing to pass in a class:

https://github.com/expo-community/expo-server-sdk-ruby/issues/43

Aryk avatar Dec 09 '21 19:12 Aryk