expo-community / expo-server-sdk-ruby Goto Github PK
View Code? Open in Web Editor NEWA Ruby library for sending push notifications with Expo's notification service
License: MIT License
A Ruby library for sending push notifications with Expo's notification service
License: MIT License
0.0.6 is still latest, but there have been 4 PRs merged at least. Who can release that ?
Thanks fam.
I am sending bunch of push notificaitons, but randomly getting this error on some of push notifications, Not sure why this is happening
My class:
### Data Used: {"content"=>"Aaaaaa", "repeat"=>nil, "repeat_unit"=>nil, "remind_at"=>nil, "completed_at"=>nil, "reminded_at"=>nil, :type=>"Reminder", :title=>"Reminder", :body=>"Aaaaaa", :sound=>"default"}
class NotificationService::EXPO < NotificationService
delegate :app, to: self
def self.app
@app ||= Exponent::Push::Client.new
end
def notify(notification)
data = notification.push_notification_data
app.publish({
to: registration_id,
sound: "default",
title: data[:title],
body: data[:body],
badge: user.total_counts["notifications"],
data: data
})
end
end
When registration_id
is not valid anymore because the EXPO app that has that registration_id
is removed from the device, it fails with:
ETHON: performed EASY effective_url=https://exp.host/--/api/v2/push/send response_code=200 return_code=ok total_time=9.14811
TypeError: no implicit conversion of String into Integer
from app/models/notification_service/expo.rb:34:in `notify'
from (irb):218
For now, I'm going to begin
rescue
that chunk.
Is there a way I can avoid that error? I can't seem to find what causes the problem.
The data I used is {"content"=>"Aaaaaa", "repeat"=>nil, "repeat_unit"=>nil, "remind_at"=>nil, "completed_at"=>nil, "reminded_at"=>nil, :type=>"Reminder", :title=>"Reminder", :body=>"Aaaaaa", :sound=>"default"}
When sending push messages i often get this error back from the gem:
"\x1F\x8B\b\x00\x00\x00\x00\x00\x00\x03uT1\x8E\x1C0\b\xFC\xCB\xD6\x87\x04\x06\x83}_\x89R`\xB0\xA5(E\x8A\xBBTQ\xFE\x1E\xF6R$R\xE2f\xB5\xDA\xF5\xC00\xCC\xF0\xE3\x91\xFE\xEE\x8F\xD7O?\x1Eo\xEF\xFE\xFE\xFD\xED\xF1\xFA\xF8\xF6\xF5\xF1\xF2\xF8\x92\xF5\xADcG\xF3\xD9\xE1X(H\xD2\x84%\xE1\x90\xDA(\xD37\x1D\x1A\x8F\x9F/\xFF\xC5\x06-\x9F+\x12\xDC\xA7\x814\xEE0vk0q\xE6\xE9\xBC\xC3\xF4\xDC\xB0\xCC94}\x01\x92;H\x9F\fUd\x00g\xF8\xD6!\x88\xC97\xAC\xB25Y\xB1`\xED\x95\xC5\x19\x03\x9C\xDD =i{\x95\xAA\xFFoX\xF3a]\x9C\x01U\x05dR\xF5={\x03\x1D=1:n]\xFB\x86\xCD\b\xCF3\x9Et[a\xDDJ+\xD5\x00\x1D\x8B<f4\x1F\xFD\x86%\xA5\xC5\xCE\ef\xE1@\x86d}k\xBBt6\x92\"\xCD\xD1\xE9\x86Et\xC7\"\b\xFE\x81\xDD3\x9E\x12;\xD4\xB8\x9A\x9Bu\xBA\xE0\r;X\x98\x0F\x1A\xC4\x11\x02\xD1'\x83\x10\x87M\r-x\xCE\xAAq\xC3\xD6C$$\x83\xAEr@bJ\xB5\xF4\x06\xBB\x9Dy\x9CO4\x92\x0F\xECo7X\xFD\xC0\xE5\x81e\xAD$Bl\xCFN\x02hh\x9D\x8At\x10U\xE5\xBF\xFB\\\xFA\x8A\xA0\xEE>\x15j\e\xB3*\xED\xD2\xAAv\x03A\x9D\xA9\x9C\xD5\xB7\xC7u^-\n\xDDj)\xB9\xB8\xB0\xBA`V{\xA0}j\xCD]Q\xFD:\xEFA.}X@\xB5l!\xDD\x05\xD6\x12\xAC\xFD\xEA\x96n\x133\xF2\xBA\xA3\xA9=h7\xE0\xB0\x05bJ\xE01\x10\xF6\xC0\xF43\e\xADv\xE5\x1Cd;Z\xF62C\xD9B\xEA%\x8CQ\x9EL\x14\x99{p\xE4\xB9z\xE3\x84r\xEE\xAD@\xF6\xE4\xAC\xB3R\x819\x00\xFD\xC8Z\xBA\xBC\xB5\xAB\x9F\x05\x97b\xE3\t\xFE\x91\x85m\xFC\xCC\xAF@699\xFA\xA4e\xEB\x86\xAD\x98\xD9\xACG\xA0V\x1F\xB2\xB8\xAE\x00\xAD\x12\x8CF\xF4\x138[\xBBj\xE5>\xBCU\xFC\v6j\xDE^&\x99\xA71$\x8D5}\xD5\xE1\xA1\xEB\xDD\xF0\xA8s5|\x80e\xAFy\x85\x12\x86g\x05q\xCD\xEC\x91#j\xEFW\x9D\x13\x8D+\xFD\xE5&\xDF\xD5\xB7\n\xCC5\bvh\xAD`m5\xBEr\x96*\xBF1\xA5\xEE\xE43G\xFD$\xACSY`\x1F|\xCE$\xEFz\xDDQ;<\x87\xD6\x89$\xB1VC{y\xE3\x94Vm\xB6\x8A\x92\x95\xB5g\xFC\xC9\x11\x17\x97N\xCD\x00\x9B\xD6\xEB\x93\x95\xA3\x11\flZ\xBB41^\xFF\xE4\xE8\xF3\xCF_\xBB\xB8\xEC!\xE6\x05\x00\x00"
rake aborted!
JSON::ParserError: 784: unexpected token at ''
/srv/storage/sites/domain.com/shared/bundle/ruby/2.4.0/gems/json-1.8.6/lib/json/common.rb:155:in `parse'
/srv/storage/sites/domain.com/shared/bundle/ruby/2.4.0/gems/json-1.8.6/lib/json/common.rb:155:in `parse'
/srv/storage/sites/domain.com/shared/bundle/ruby/2.4.0/gems/exponent-server-sdk-0.0.6/lib/exponent-server-sdk.rb:69:in `parse_json'
/srv/storage/sites/domain.com/shared/bundle/ruby/2.4.0/gems/exponent-server-sdk-0.0.6/lib/exponent-server-sdk.rb:60:in `handle'
/srv/storage/sites/domain.com/shared/bundle/ruby/2.4.0/gems/exponent-server-sdk-0.0.6/lib/exponent-server-sdk.rb:20:in `publish'
/srv/storage/sites/domain.com/releases/20190514123305/app/models/news_push_notifier.rb:20:in `block in deliver_all'
/srv/storage/sites/domain.com/releases/20190514123305/app/models/news_push_notifier.rb:19:in `each'
/srv/storage/sites/domain.com/releases/20190514123305/app/models/news_push_notifier.rb:19:in `each_slice'
/srv/storage/sites/domain.com/releases/20190514123305/app/models/news_push_notifier.rb:19:in `deliver_all'
/srv/storage/sites/domain.com/releases/20190514123305/lib/tasks/push.rake:5:in `block (3 levels) in <top (required)>'
/srv/storage/sites/domain.com/shared/bundle/ruby/2.4.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in `load'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/cli/exec.rb:28:in `run'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/cli.rb:463:in `exec'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/cli.rb:27:in `dispatch'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/cli.rb:18:in `start'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/exe/bundle:30:in `block in <top (required)>'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/home/web/.rvm/gems/ruby-2.4.2/gems/bundler-2.0.1/exe/bundle:22:in `<top (required)>'
/home/web/.rvm/gems/ruby-2.4.2/bin/bundle:23:in `load'
/home/web/.rvm/gems/ruby-2.4.2/bin/bundle:23:in `<main>'
/home/web/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:15:in `eval'
/home/web/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => dk:push:execute
(See full trace by running task with --trace)
It seems to be related with the returned json from the expo server.
My code looks like this
client = Exponent::Push::Client.new(gzip: true)
messages = Device.all.map { |device|
{
to: device.device_token,
sound: "default",
body: "Todays news is ready for you"
}
}
puts "Messages to deliver: " + messages.count.to_s
puts messages.to_s
if messages.count > 0
messages.each_slice(25) do |slide|
resp = client.publish slide
puts resp.inspect
end
end
end
I know this is similar to issues #33, #37, and #38; however, it has slightly different symptoms (different top expo SDK stack frames, only sending a single message, etc.). The following shows my application debug log sending a single message to a single device (details removed for privacy), and expo-server-sdk-ruby throws Exponent::Push::UnknownError: Unknown error format: #<Typhoeus::Response:0x00007f0bf98a6248>
from exponent-server-sdk.rb } process_response
Feb 09 22:45:04 web24 rails[3377]: [e3013c2e-16f0-47dc-a61d-78d33bb36db8] Notification.try_send_notification for identity 2194: [
[0] {
:to => "ExponentPushToken[$REMOVED]",
:body => "$SUBJECT",
:sound => "default",
:badge => 0,
:priority => "high",
:data => {
:identity => 2194,
:notification_category => "$CATEGORY",
:subject => "$SUBJECT"
}
}
]
Feb 09 22:46:05 web24 rails[3377]: [e3013c2e-16f0-47dc-a61d-78d33bb36db8] ApplicationController.catchall: #<Exponent::Push::UnknownError: Unknown error format: #<Typhoeus::Response:0x00007f0bf98a6248>>
Feb 09 22:46:05 web24 rails[3377]: [e3013c2e-16f0-47dc-a61d-78d33bb36db8] ApplicationController.catchall exception details: #<Exponent::Push::UnknownError: Unknown error format: #<Typhoeus::Response:0x00007f0bf98a6248>
/var/www/html/app/vendor/bundle/ruby/2.6.0/gems/exponent-server-sdk-0.1.0/lib/exponent-server-sdk.rb:127:in `process_response'
/var/www/html/app/vendor/bundle/ruby/2.6.0/gems/exponent-server-sdk-0.1.0/lib/exponent-server-sdk.rb:63:in `send_messages'
/var/www/html/app/app/models/notification.rb:213:in `try_send_notification' [...]
Currently using this sdk, I'm unable to sent push notifications which was working fine before. I have tested multiple times with other sdk and with curl -H "Content-Type: application/json" -X POST https://exp.host/--/api/v2/push/send -d '{ "to": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]", "title":"hello", "body": "world" }'
and it sends push notification, but issue persist with this sdk.
Hi, we're looking for one or two developers who use this SDK and would like to help the Expo community. The responsibilities include modernizing the library, reviewing PRs, updating the SDK when the server API changes (this is infrequent), helping people out with Ruby-specific issues, writing release notes, and publishing gems. Some specific projects that come to mind are:
The Node SDK is maintained by the Expo team and can act as a reference starting point for other languages. An ideal collaborator would have meaningful experience with Ruby and HTTP (been doing it daily for a couple of years) and some comfort with JS and Node to read through the Node SDK, and also use this library in production and care about making it work well. If you're interested, please leave a comment here.
Steps to Reproduce
gem install exponent-server-sdk
lib/exponent-server-sdk.rb
file.Expectation
Contents should match current source file here: https://github.com/expo/exponent-server-sdk-ruby/blob/master/lib/exponent-server-sdk.rb
Actual Result
Contents matches the old v0.0.1 build.
Note that the gem's version.rb
file correctly indicates version 0.0.2
. I suspect maybe there was some git trickery at play here when someone committed changes to the exponent-server-sdk.rb
file :)
We are recommended to pass in an array of messages to expo server, to reduce the number of requests being made.
However, when I make a request where there is an array, the response object only displays one element.
I think this has to do with:
def extract_data(response)
response.fetch('data').first
end
Is there a reason for this? Why not simply return response.fetch('data')
Even better, it may be a good idea to do:
def extract_data(response)
data = response.fetch('data')
(data.class == Hash) ? [data] : data
end
So we can always expect an array response.
I'm not sure if I'm missing something, which is why I'm posting here.
Add hierarchy of objects to model all current possible error receipts. Make it easy to extend.
Hey guys, should we have one Exponent::Push::Client.new running for the whole app? Or should we initialize a new client on every single push call?
When does the client close and is it a memory hog?
Helping a colleague try to debug UnknownError
in dealing with this API, and I notice a PR (#36) related to it. That PR has five "+1" comments and a few ๐ reactions, but has not been merged.
We're trying to decide whether to reimplement our own internal gem for this or contribute back to this project. I would prefer to do this work in public, but if nobody is paying attention, there seems to be little point.
taps mic
Is this thing on?
I hate to submit an issue while you are figuring out gem maintainers. However, I have to say that only showing the first error message when a bulk request fails is not helpful especially when you need to be able to parse all the failed tokens so that you can remove them from future requests. The response should ideally still accessible regardless of error so that the user can choose how to respond.
Can someone with permission turn on Travis builds? You can do so here.
In the docs there seems to be a better endpoint that allows an array of messages and a more complex message type that includes things like badges. Are there plans to update this gem to support that?
I'm not sure there is much activity on this gem.
I've been getting different errors not capable of being handled by this gem and see tons of deprecated stuff.
So I thought I would just take this gem and tear it a new one, fix a few problems and just make it easier to parse and understand.
ssl_verifypeer: false
to get the gem working in AWS if you are in that environment.https://github.com/tribefyhq/expo-server-sdk-ruby
Maybe it's helpful for someone here.
Exponent::Push::UnknownError: Unknown error format: {}
from exponent-server-sdk (0.1.0) lib/exponent-server-sdk.rb:143:in `handle'
from exponent-server-sdk (0.1.0) lib/exponent-server-sdk.rb:51:in `publish'
from app/workers/expo_worker.rb:15:in `perform'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:196:in `execute_job'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:164:in `block (2 levels) in process'
from sidekiq (6.1.2) lib/sidekiq/middleware/chain.rb:138:in `block in invoke'
from newrelic_rpm (6.14.0) lib/new_relic/agent/instrumentation/sidekiq.rb:35:in `block in call'
from newrelic_rpm (6.14.0) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:376:in `perform_action_with_newrelic_trace'
from newrelic_rpm (6.14.0) lib/new_relic/agent/instrumentation/sidekiq.rb:30:in `call'
from sidekiq (6.1.2) lib/sidekiq/middleware/chain.rb:140:in `block in invoke'
from sentry-raven (3.1.1) lib/raven/integrations/sidekiq/cleanup_middleware.rb:7:in `call'
from sidekiq (6.1.2) lib/sidekiq/middleware/chain.rb:140:in `block in invoke'
from sidekiq (6.1.2) lib/sidekiq/middleware/chain.rb:143:in `invoke'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:163:in `block in process'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:136:in `block (6 levels) in dispatch'
from sidekiq (6.1.2) lib/sidekiq/job_retry.rb:111:in `local'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:135:in `block (5 levels) in dispatch'
from sidekiq (6.1.2) lib/sidekiq/rails.rb:14:in `block in call'
from activesupport (6.0.3.4) lib/active_support/execution_wrapper.rb:88:in `wrap'
from activesupport (6.0.3.4) lib/active_support/reloader.rb:72:in `block in wrap'
from activesupport (6.0.3.4) lib/active_support/execution_wrapper.rb:88:in `wrap'
from activesupport (6.0.3.4) lib/active_support/reloader.rb:71:in `wrap'
from sidekiq (6.1.2) lib/sidekiq/rails.rb:13:in `call'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:131:in `block (4 levels) in dispatch'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:257:in `stats'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:126:in `block (3 levels) in dispatch'
from sidekiq (6.1.2) lib/sidekiq/job_logger.rb:13:in `call'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:125:in `block (2 levels) in dispatch'
from sidekiq (6.1.2) lib/sidekiq/job_retry.rb:78:in `global'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:124:in `block in dispatch'
from sidekiq (6.1.2) lib/sidekiq/logger.rb:10:in `with'
from sidekiq (6.1.2) lib/sidekiq/job_logger.rb:33:in `prepare'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:123:in `dispatch'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:162:in `process'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:78:in `process_one'
from sidekiq (6.1.2) lib/sidekiq/processor.rb:68:in `run'
from sidekiq (6.1.2) lib/sidekiq/util.rb:15:in `watchdog'
from sidekiq (6.1.2) lib/sidekiq/util.rb:24:in `block in safe_thread'
Hello!
I have been trying to install the gem and i'm getting this stack trace :
rails aborted!
LoadError: Could not open library 'libcurl': libcurl: cannot open shared object file: No such file or directory.
Could not open library 'libcurl.so': libcurl.so: cannot open shared object file: No such file or directory.
Could not open library 'libcurl.so.4': libcurl.so.4: cannot open shared object file: No such file or directory
/usr/local/bundle/gems/ffi-1.9.14/lib/ffi/library.rb:147:in block in ffi_lib' /usr/local/bundle/gems/ffi-1.9.14/lib/ffi/library.rb:100:in
map'
/usr/local/bundle/gems/ffi-1.9.14/lib/ffi/library.rb:100:in ffi_lib' /usr/local/bundle/gems/ethon-0.11.0/lib/ethon/curls/settings.rb:7:in
module:Curl'
/usr/local/bundle/gems/ethon-0.11.0/lib/ethon/curls/settings.rb:2:in <module:Ethon>' /usr/local/bundle/gems/ethon-0.11.0/lib/ethon/curls/settings.rb:1:in
<top (required)>'
/usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in require' /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in
block in require'
/usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in
require'
/usr/local/bundle/gems/ethon-0.11.0/lib/ethon/curl.rb:27:in <module:Curl>' /usr/local/bundle/gems/ethon-0.11.0/lib/ethon/curl.rb:13:in
module:Ethon'
/usr/local/bundle/gems/ethon-0.11.0/lib/ethon/curl.rb:8:in <top (required)>' /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in
require'
/usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in block in require' /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in
load_dependency'
/usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in require' /usr/local/bundle/gems/ethon-0.11.0/lib/ethon.rb:15:in
<top (required)>'
/usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in require' /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in
block in require'
/usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in load_dependency' /usr/local/bundle/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in
require'
/usr/local/bundle/gems/typhoeus-1.3.0/lib/typhoeus.rb:2:in <top (required)>' /usr/local/bundle/gems/bundler-1.16.3/lib/bundler/runtime.rb:81:in
require'
/usr/local/bundle/gems/bundler-1.16.3/lib/bundler/runtime.rb:81:in block (2 levels) in require' /usr/local/bundle/gems/bundler-1.16.3/lib/bundler/runtime.rb:76:in
each'
/usr/local/bundle/gems/bundler-1.16.3/lib/bundler/runtime.rb:76:in block in require' /usr/local/bundle/gems/bundler-1.16.3/lib/bundler/runtime.rb:65:in
each'
/usr/local/bundle/gems/bundler-1.16.3/lib/bundler/runtime.rb:65:in require' /usr/local/bundle/gems/bundler-1.16.3/lib/bundler.rb:114:in
require'
/var/www/docker/config/application.rb:9:in <top (required)>' /var/www/docker/Rakefile:4:in
require_relative'
/var/www/docker/Rakefile:4:in <top (required)>' /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/rake_proxy.rb:12:in
block in run_rake_task'
/usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/rake_proxy.rb:10:in run_rake_task' /usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:51:in
run_command!'
/usr/local/bundle/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in <top (required)>' /var/www/docker/bin/rails:9:in
require'
/var/www/docker/bin/rails:9:in <top (required)>' /usr/local/bundle/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in
load'
/usr/local/bundle/gems/spring-2.0.0/lib/spring/client/rails.rb:28:in call' /usr/local/bundle/gems/spring-2.0.0/lib/spring/client/command.rb:7:in
call'
/usr/local/bundle/gems/spring-2.0.0/lib/spring/client.rb:30:in run' /usr/local/bundle/gems/spring-2.0.0/bin/spring:49:in
<top (required)>'
/usr/local/bundle/gems/spring-2.0.0/lib/spring/binstub.rb:31:in load' /usr/local/bundle/gems/spring-2.0.0/lib/spring/binstub.rb:31:in
<top (required)>'
/var/www/docker/bin/spring:14:in require' /var/www/docker/bin/spring:14:in
<top (required)>'
bin/rails:3:in load' bin/rails:3:in
Would someone know which gem i am missing?
I've installed the gem in my rails app and this code:
client = Exponent::Push::Client.new
results in NameError: uninitialized constant Exponent.
If I try to require it, I get this error:
LoadError: cannot load such file -- exponent-server-sdk
It's possible I'm doing something stupid here. Any help will be appreciated.
I recently got a bunch of An unknown error occurred. (Exponent::Push::UnknownError)
errors:
/app/codecademy/shared/bundle/ruby/2.5.0/gems/exponent-server-sdk-0.0.6/lib/exponent-server-sdk.rb:57:in `handle': An unknown error occurred. (Exponent::Push::UnknownError)
from /app/codecademy/shared/bundle/ruby/2.5.0/gems/exponent-server-sdk-0.0.6/lib/exponent-server-sdk.rb:20:in `publish'
from script/mobile/send_reminder_notifications.rb:18:in `block in send_notifications'
...(more from our call stack)
...that's about all the info contained. Is it possible to have more debug info logged with UnknownError
? Maybe some or all of: the request URI, server response code, any error text it includes, some kind of unique ID if that exists in the system?
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
I suggest this is due to the token being nil,
however it maybe helpful to have a more explicit error ?
2020-11-21T21:40:32.537557+00:00 app[web.1]: D, [2020-11-21T21:40:32.537319 #4] DEBUG -- : [d41e1d66-ff94-45d1-a3e3-f597c970db6f] ETHON: performed EASY effective_url=https://exp.host/--/api/v2/push/send response_code=400 return_code=ok total_time=0.370627
2020-11-21T21:40:32.538666+00:00 app[web.1]: D, [2020-11-21T21:40:32.538601 #4] DEBUG -- : [d41e1d66-ff94-45d1-a3e3-f597c970db6f] (0.9ms) ROLLBACK
2020-11-21T21:40:32.539024+00:00 app[web.1]: I, [2020-11-21T21:40:32.538960 #4] INFO -- : [d41e1d66-ff94-45d1-a3e3-f597c970db6f] Completed 500 Internal Server Error in 512ms (ActiveRecord: 8.9ms)
2020-11-21T21:40:32.539642+00:00 app[web.1]: F, [2020-11-21T21:40:32.539587 #4] FATAL -- : [d41e1d66-ff94-45d1-a3e3-f597c970db6f]
2020-11-21T21:40:32.539708+00:00 app[web.1]: F, [2020-11-21T21:40:32.539645 #4] FATAL -- : [d41e1d66-ff94-45d1-a3e3-f597c970db6f] Exponent::Push::UnknownError (Unknown error format: #<Typhoeus::Response:0x000055fad02ead08>):
2020-11-21T21:40:32.539741+00:00 app[web.1]: F, [2020-11-21T21:40:32.539695 #4] FATAL -- : [d41e1d66-ff94-45d1-a3e3-f597c970db6f]
2020-11-21T21:40:32.539789+00:00 app[web.1]: F, [2020-11-21T21:40:32.539745 #4] FATAL -- : [d41e1d66-ff94-45d1-a3e3-f597c970db6f] app/models/booking.rb:168:in `send_booking_notification'
Just installed this gem and getting the following error when trying to use:
objc[2642]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
rails | objc[2642]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
Running
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-darwin21]
rails 5.2.6
Thanks
Hello!
I was reading the Expo SDK 29 release notes today and saw all the changes around Push Notifications, the node-sdk has been updated by the expo team, and they said this:
Is the Pipefy takeover old news or did it just happen? As far as I can tell no Pipefy members have contributed to this repository and no notes about them taking it over have been made. Will we be seeing push notification read receipt support added in the near future by the Pipefy team?
Our team might be able to contribute to this feature, but we don't want to duplicate effort with the Pipefy team.
Currently to follow the guidelines outlined here we can use this gem to push notifications and get the response, but then to verify them we need to make push receipt requests outside of this gem. Should this gem handle those?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.