简体   繁体   中英

Rails Apnotic OpenSSL alert certificate expired error

I'm trying to send Apple Push Notifications from a Rails app using the Apnotic gem.

I get the following error when I run @ios_client.push(note) .

Traceback (most recent call last):
    5: from /app/vendor/bundle/ruby/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:114:in `block (2 levels) in ensure_open'
    4: from /app/vendor/bundle/ruby/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:142:in `socket_loop'
    3: from /app/vendor/bundle/ruby/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:142:in `loop'
    2: from /app/vendor/bundle/ruby/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:145:in `block in socket_loop'
    1: from /app/vendor/ruby-2.6.5/lib/ruby/2.6.0/openssl/buffering.rb:182:in `read_nonblock'
/app/vendor/ruby-2.6.5/lib/ruby/2.6.0/openssl/buffering.rb:182:in `sysread_nonblock': SSL_read: sslv3 alert certificate expired (OpenSSL::SSL::SSLError)

I believe my certificate that I obtained from the Apple Developer account is not expired (I tested by creating a new one), so is there something wrong with my OpenSSL installation?

I get the same error locally and on Heroku. How can I fix this?

Check your certificate, open it by your desktop environment and see if the date is between not valid before and not valid after .

将密钥粘贴到文件并使用 .pem 保存

First save your key with .pem

关键细节 If you are using mac, click the file just saved and press space bar to check valid date

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM