来自twilio api的错误URI错误

时间:2017-10-07 23:01:43

标签: rubygems twilio twilio-api

当我尝试使用twilio-api发送消息时,我收到以下错误。

/Users/me/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/common.rb:146:in `split': bad URI(absolute but no path): api.twilio.com:// (URI::InvalidURIError)

和完整的堆栈跟踪:

from /Users/me/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/common.rb:211:in `parse'
from /Users/me/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/uri/common.rb:747:in `parse'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/faraday-0.13.1/lib/faraday/connection.rb:453:in `proxy_from_env'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/faraday-0.13.1/lib/faraday/connection.rb:85:in `initialize'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/faraday-0.13.1/lib/faraday.rb:67:in `new'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/faraday-0.13.1/lib/faraday.rb:67:in `new'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/twilio-ruby-5.3.1/lib/twilio-ruby/http/http_client.rb:21:in `_request'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/twilio-ruby-5.3.1/lib/twilio-ruby/http/http_client.rb:54:in `request'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/twilio-ruby-5.3.1/lib/twilio-ruby/rest/client.rb:70:in `request'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/twilio-ruby-5.3.1/lib/twilio-ruby/framework/domain.rb:20:in `request'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/twilio-ruby-5.3.1/lib/twilio-ruby/framework/version.rb:51:in `request'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/twilio-ruby-5.3.1/lib/twilio-ruby/framework/version.rb:154:in `create'
from /Users/me/.rvm/gems/ruby-2.1.5/gems/twilio-ruby-5.3.1/lib/twilio-ruby/rest/api/v2010/account/message.rb:71:in `create'
from send_message.rb:19:in `mms'

send_message.rb

client = Twilio::REST::Client.new(ACCOUNT_SID, AUTH_TOKEN
client.messages.create(
  from: TWILIO_PHONE_NUMBER,
  to: MY_PHONE_NUMBER,
  body: 'test'
)

如果我检查client我可以看到它是一个Twilio :: Rest :: Client。它可能是一个宝石依赖问题吗?

1 个答案:

答案 0 :(得分:0)

解决方案包括完全关闭终端,然后重新启动并重新安装所有宝石。