urbanairship / ruby-library

A Ruby wrapper for the Urban Airship API.
Other
200 stars 117 forks source link

No such file or directory - getcwd #101

Closed maxdbn closed 7 years ago

maxdbn commented 7 years ago

I'm getting this exception from time to time while sending push notifications. I thought that this is because of insufficient permissions for urbanairship.log but giving permissions to this file or his parent folder did not help.

I'm running this code on my staging environment using Elastic Beanstalk.

What files are being used by this code except urbanairship.log? Can I disable logging completely?

This doesn't happen on my development environment.

  def send_push(user, message)
    return unless user.has_role?(:notifiable) && user.ua_platform? && user.ua_channel?
    p = ua_client.create_push
    channel_type = "#{user.ua_platform}_channel"
    channel_id = user.ua_channel
    p.audience = UA.public_send(channel_type, channel_id)
    p.notification = UA.notification(alert: message)
    p.device_types = UA.all
    p.send_push
  end

the last line throws the exception

full trace:

Errno::ENOENT: No such file or directory - getcwd from netrc.rb:24:in pwd' from netrc.rb:24:inhome_path' from netrc.rb:11:in default_path' from netrc.rb:51:inread' from restclient/request.rb:657:in parse_url_with_auth!' from restclient/request.rb:133:ininitialize' from restclient/request.rb:52:in new' from restclient/request.rb:52:inexecute' from urbanairship/client.rb:59:in send_request' from urbanairship/push/push.rb:41:insend_push' from app/services/urbanairship_adapter.rb:48:in send_push' from app/services/urbanairship_adapter.rb:24:inno_offer' from app/jobs/no_offer_email_job.rb:6:in perform' from active_job/execution.rb:34:inblock in perform_now' from active_support/callbacks.rb:126:in call' from active_support/callbacks.rb:506:inblock (2 levels) in compile' from active_support/callbacks.rb:455:in call' from active_support/callbacks.rb:448:inblock (2 levels) in around' from active_support/callbacks.rb:286:in block (2 levels) in halting' from i18n.rb:257:inwith_locale' from active_job/translation.rb:7:in block (2 levels) in <module:Translation>' from active_support/callbacks.rb:391:ininstance_exec' from active_support/callbacks.rb:391:in block in make_lambda' from active_support/callbacks.rb:285:inblock in halting' from active_support/callbacks.rb:447:in block in around' from active_support/callbacks.rb:455:incall' from active_support/callbacks.rb:448:in block (2 levels) in around' from active_support/callbacks.rb:286:inblock (2 levels) in halting' from active_job/logging.rb:24:in block (4 levels) in <module:Logging>' from active_support/notifications.rb:164:inblock in instrument' from active_support/notifications/instrumenter.rb:21:in instrument' from active_support/notifications.rb:164:ininstrument' from active_job/logging.rb:23:in block (3 levels) in <module:Logging>' from active_job/logging.rb:44:inblock in tag_logger' from active_support/tagged_logging.rb:70:in block in tagged' from active_support/tagged_logging.rb:26:intagged' from active_support/tagged_logging.rb:70:in tagged' from active_job/logging.rb:44:intag_logger' from active_job/logging.rb:20:in block (2 levels) in <module:Logging>' from active_support/callbacks.rb:391:ininstance_exec' from active_support/callbacks.rb:391:in block in make_lambda' from active_support/callbacks.rb:285:inblock in halting' from active_support/callbacks.rb:447:in block in around' from active_support/callbacks.rb:455:incall' from active_support/callbacks.rb:101:in __run_callbacks__' from active_support/callbacks.rb:750:in_run_perform_callbacks' from active_support/callbacks.rb:90:in run_callbacks' from active_job/execution.rb:33:inperform_now' from active_job/execution.rb:16:in perform_now' from app/models/search_report/log.rb:6:innotify_user!' from active_support/callbacks.rb:382:in block in make_lambda' from active_support/callbacks.rb:232:inblock in conditional' from active_support/callbacks.rb:456:in block in call' from active_support/callbacks.rb:456:ineach' from active_support/callbacks.rb:456:in call' from active_support/callbacks.rb:101:inrun_callbacks__' from active_support/callbacks.rb:750:in _run_commit_callbacks' from active_record/transactions.rb:354:incommitted!' from active_record/connection_adapters/abstract/transaction.rb:87:in commit_records' from active_record/connection_adapters/abstract/transaction.rb:178:incommit_transaction' from active_record/connection_adapters/abstract/transaction.rb:202:in within_new_transaction' from active_record/connection_adapters/abstract/database_statements.rb:232:intransaction' from active_record/transactions.rb:211:in transaction' from active_record/associations/collection_association.rb:202:intransaction' from active_record/associations/collection_association.rb:516:in _create_record' from active_record/associations/has_many_association.rb:136:in_create_record' from active_record/associations/collection_association.rb:172:in create' from active_record/associations/collection_proxy.rb:325:increate' from app/models/reduction_order.rb:165:in create_report!' from app/jobs/report_job.rb:6:inperform' from active_job/execution.rb:34:in block in perform_now' from active_support/callbacks.rb:126:incall' from active_support/callbacks.rb:506:in block (2 levels) in compile' from active_support/callbacks.rb:455:incall' from active_support/callbacks.rb:448:in block (2 levels) in around' from active_support/callbacks.rb:286:inblock (2 levels) in halting' from i18n.rb:257:in with_locale' from active_job/translation.rb:7:inblock (2 levels) in ' from active_support/callbacks.rb:391:in instance_exec' from active_support/callbacks.rb:391:inblock in make_lambda' from active_support/callbacks.rb:285:in block in halting' from active_support/callbacks.rb:447:inblock in around' from active_support/callbacks.rb:455:in call' from active_support/callbacks.rb:448:inblock (2 levels) in around' from active_support/callbacks.rb:286:in block (2 levels) in halting' from active_job/logging.rb:24:inblock (4 levels) in ' from active_support/notifications.rb:164:in block in instrument' from active_support/notifications/instrumenter.rb:21:ininstrument' from active_support/notifications.rb:164:in instrument' from active_job/logging.rb:23:inblock (3 levels) in ' from active_job/logging.rb:44:in block in tag_logger' from active_support/tagged_logging.rb:70:inblock in tagged' from active_support/tagged_logging.rb:26:in tagged' from active_support/tagged_logging.rb:70:intagged' from active_job/logging.rb:44:in tag_logger' from active_job/logging.rb:20:inblock (2 levels) in ' from active_support/callbacks.rb:391:in instance_exec' from active_support/callbacks.rb:391:inblock in make_lambda' from active_support/callbacks.rb:285:in block in halting' from active_support/callbacks.rb:447:inblock in around' from active_support/callbacks.rb:455:in call' from active_support/callbacks.rb:101:inrun_callbacks' from active_support/callbacks.rb:750:in _run_perform_callbacks' from active_support/callbacks.rb:90:inrun_callbacks' from active_job/execution.rb:33:in perform_now' from active_job/execution.rb:22:inblock in execute' from active_support/callbacks.rb:126:in call' from active_support/callbacks.rb:506:inblock (2 levels) in compile' from active_support/callbacks.rb:455:in call' from active_support/callbacks.rb:448:inblock (2 levels) in around' from active_support/callbacks.rb:286:in block (2 levels) in halting' from active_job/railtie.rb:26:inblock (4 levels) in ' from active_support/execution_wrapper.rb:76:in wrap' from active_support/reloader.rb:68:inblock in wrap' from active_support/execution_wrapper.rb:72:in wrap' from active_support/reloader.rb:67:inwrap' from active_job/railtie.rb:25:in block (3 levels) in <class:Railtie>' from active_support/callbacks.rb:391:ininstance_exec' from active_support/callbacks.rb:391:in block in make_lambda' from active_support/callbacks.rb:285:inblock in halting' from active_support/callbacks.rb:447:in block in around' from active_support/callbacks.rb:455:incall' from active_support/callbacks.rb:101:in `run_callbacks__' from active_support/callbacks.rb:750:in _run_execute_callbacks' from active_support/callbacks.rb:90:inrun_callbacks' from active_job/execution.rb:20:in execute' from active_job/queue_adapters/sidekiq_adapter.rb:40:inperform' from sidekiq/processor.rb:158:in execute_job' from sidekiq/processor.rb:138:inblock (4 levels) in process' from sidekiq/rails.rb:86:in block in call' from active_support/execution_wrapper.rb:76:inwrap' from sidekiq/rails.rb:85:in call' from sidekiq/processor.rb:133:inblock (3 levels) in process' from sidekiq/middleware/chain.rb:128:in block in invoke' from sidetiq/middleware/history.rb:8:incall' from sidekiq/middleware/chain.rb:130:in block in invoke' from sidekiq/middleware/server/retry_jobs.rb:74:incall' from sidekiq/middleware/chain.rb:130:in block in invoke' from sidekiq/middleware/server/logging.rb:11:inblock in call' from sidekiq/logging.rb:32:in with_context' from sidekiq/middleware/server/logging.rb:7:incall' from sidekiq/middleware/chain.rb:130:in block in invoke' from sidekiq/middleware/chain.rb:133:ininvoke' from sidekiq/processor.rb:132:in block (2 levels) in process' from sidekiq/processor.rb:174:instats' from sidekiq/processor.rb:131:in block in process' from sidekiq.rb:35:inblock in ' from sidekiq/processor.rb:126:in process' from sidekiq/processor.rb:82:inprocess_one' from sidekiq/processor.rb:70:in run' from sidekiq/util.rb:17:inwatchdog' from sidekiq/util.rb:25:in `block in safe_thread'

maxdbn commented 7 years ago

Please close this issue, it's not cause of this gem. It was because I didn't restart Sidekiq and a gem you use (rest-client) was referring directories that doesn't exist anymore.