/ / 500 आंतरिक सर्वर त्रुटि टवीलियो का उपयोग कर एक एसएमएस भेजने की कोशिश कर रहा है - रूबी, हरोकू, सिनट्रा, ट्विलियो

500 आंतरिक सर्वर त्रुटि Twilio - रूबी, heroku, sinatra, twilio का उपयोग कर एक एसएमएस भेजने की कोशिश कर रहा है

सिनात्रा ऐप को होस्ट करने के लिए हरोकू का उपयोग करना। मेरे पास एक मार्ग है जो एक एसएमएस भेजने वाला है। इसके बदले 500 आंतरिक सर्वर त्रुटि देता है।

लोकलहोस्ट में सब कुछ पूरी तरह से ठीक है। लॉग एक टवीलियो :: REST :: RequestError दिखाते हैं।

main.rb

post "/sms/send" do

@client = Twilio::REST::Client.new account_sid, auth_token

@client.account.messages.create(
from: "+xxxxxxxxxxx",
to: "+xxxxxxxxxxx",
body: "Robot invasion! Reply back with any sightings."
)
end

लॉग्स:

2017-05-17T19:04:24.640120+00:00 heroku[router]: at=info method=POST path="/sms/send" host=dysfunctionalapp.herokuapp.com request_id=a3736f1a-2264-4b91-b0a9-a3bde94342bd fwd="216.73.77.194" dyno=web.1 connect=0ms service=22ms status=500 bytes=255 protocol=https
2017-05-17T19:04:24.639060+00:00 app[web.1]: 2017-05-17 19:04:24 - Twilio::REST::RequestError - Twilio::REST::RequestError:
2017-05-17T19:04:24.639072+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/twilio-ruby-4.13.0/lib/twilio-ruby/rest/base_client.rb:125:in `connect_and_send"
2017-05-17T19:04:24.639074+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/twilio-ruby-4.13.0/lib/twilio-ruby/rest/base_client.rb:55:in `block (2 levels) in <class:BaseClient>"
2017-05-17T19:04:24.639075+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/twilio-ruby-4.13.0/lib/twilio-ruby/rest/list_resource.rb:94:in `create"
2017-05-17T19:04:24.639076+00:00 app[web.1]:    /app/main.rb:84:in `block in <top (required)>"
2017-05-17T19:04:24.639078+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1632:in `call"
2017-05-17T19:04:24.639078+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1632:in `block in compile!"
2017-05-17T19:04:24.639079+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:991:in `block (3 levels) in route!"
2017-05-17T19:04:24.639095+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1010:in `route_eval"
2017-05-17T19:04:24.639096+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:991:in `block (2 levels) in route!"
2017-05-17T19:04:24.639097+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1037:in `block in process_route"
2017-05-17T19:04:24.639097+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1035:in `catch"
2017-05-17T19:04:24.639098+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1035:in `process_route"
2017-05-17T19:04:24.639099+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:989:in `block in route!"
2017-05-17T19:04:24.639099+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:988:in `each"
2017-05-17T19:04:24.639100+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:988:in `route!"
2017-05-17T19:04:24.639101+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1094:in `block in dispatch!"
2017-05-17T19:04:24.639101+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `block in invoke"
2017-05-17T19:04:24.639102+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `catch"
2017-05-17T19:04:24.639102+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `invoke"
2017-05-17T19:04:24.639103+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1091:in `dispatch!"
2017-05-17T19:04:24.639104+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:923:in `block in call!"
2017-05-17T19:04:24.639105+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `block in invoke"
2017-05-17T19:04:24.639105+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `catch"
2017-05-17T19:04:24.639106+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1073:in `invoke"
2017-05-17T19:04:24.639106+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:923:in `call!"
2017-05-17T19:04:24.639107+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:913:in `call"
2017-05-17T19:04:24.639108+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/xss_header.rb:18:in `call"
2017-05-17T19:04:24.639108+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/path_traversal.rb:16:in `call"
2017-05-17T19:04:24.639109+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/json_csrf.rb:26:in `call"
2017-05-17T19:04:24.639110+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/base.rb:50:in `call"
2017-05-17T19:04:24.639110+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/base.rb:50:in `call"
2017-05-17T19:04:24.639111+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/rack-protection-2.0.0/lib/rack/protection/frame_options.rb:31:in `call"
2017-05-17T19:04:24.639112+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/logger.rb:15:in `call"
2017-05-17T19:04:24.639113+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/common_logger.rb:33:in `call"
2017-05-17T19:04:24.639113+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:231:in `call"
2017-05-17T19:04:24.639114+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:224:in `call"
2017-05-17T19:04:24.639114+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/head.rb:12:in `call"
2017-05-17T19:04:24.639115+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/method_override.rb:22:in `call"
2017-05-17T19:04:24.639116+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:194:in `call"
2017-05-17T19:04:24.639116+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1955:in `call"
2017-05-17T19:04:24.639117+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1499:in `block in call"
2017-05-17T19:04:24.639118+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1726:in `synchronize"
2017-05-17T19:04:24.639118+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/sinatra-2.0.0/lib/sinatra/base.rb:1499:in `call"
2017-05-17T19:04:24.639125+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/lib/thin/connection.rb:86:in `block in pre_process"
2017-05-17T19:04:24.639125+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/lib/thin/connection.rb:84:in `catch"
2017-05-17T19:04:24.639126+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/lib/thin/connection.rb:84:in `pre_process"
2017-05-17T19:04:24.639127+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/lib/thin/connection.rb:53:in `process"
2017-05-17T19:04:24.639127+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/lib/thin/connection.rb:39:in `receive_data"
2017-05-17T19:04:24.639129+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/eventmachine-1.2.3/lib/eventmachine.rb:194:in `run_machine"
2017-05-17T19:04:24.639130+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/eventmachine-1.2.3/lib/eventmachine.rb:194:in `run"
2017-05-17T19:04:24.639130+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/lib/thin/backends/base.rb:73:in `start"
2017-05-17T19:04:24.639131+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/lib/thin/server.rb:162:in `start"
2017-05-17T19:04:24.639132+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/lib/thin/controllers/controller.rb:87:in `start"
2017-05-17T19:04:24.639133+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/lib/thin/runner.rb:200:in `run_command"
2017-05-17T19:04:24.639133+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/lib/thin/runner.rb:156:in `run!"
2017-05-17T19:04:24.639134+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/thin-1.7.0/bin/thin:6:in `<top (required)>"
2017-05-17T19:04:24.639135+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/bin/thin:22:in `load"
2017-05-17T19:04:24.639137+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `load"
2017-05-17T19:04:24.639136+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/bin/thin:22:in `<top (required)>"
2017-05-17T19:04:24.639138+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:74:in `kernel_load"
2017-05-17T19:04:24.639139+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/cli.rb:332:in `exec"
2017-05-17T19:04:24.639140+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run"
2017-05-17T19:04:24.639138+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/cli/exec.rb:27:in `run"
2017-05-17T19:04:24.639140+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command"
2017-05-17T19:04:24.639141+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch"
2017-05-17T19:04:24.639142+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/cli.rb:20:in `dispatch"
2017-05-17T19:04:24.639143+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start"
2017-05-17T19:04:24.639144+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/cli.rb:11:in `start"
2017-05-17T19:04:24.639144+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/exe/bundle:34:in `block in <top (required)>"
2017-05-17T19:04:24.639145+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/lib/bundler/friendly_errors.rb:100:in `with_friendly_errors"
2017-05-17T19:04:24.639146+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/gems/bundler-1.13.7/exe/bundle:26:in `<top (required)>"
2017-05-17T19:04:24.639146+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/bin/bundle:22:in `load"
2017-05-17T19:04:24.639147+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.4.0/bin/bundle:22:in `<main>"
2017-05-17T19:04:24.639551+00:00 app[web.1]: 216.73.77.194 - - [17/May/2017:19:04:24 +0000] "POST /sms/send HTTP/1.1" 500 30 0.0217

मैं खो गया हूँ।

उत्तर:

जवाब के लिए 0 № 1

टिप्पणी में चर्चा के अनुसार, आपके पास कॉन्फ़िगरेशन की समस्या है। आप स्थानीय रूप से (विकास वातावरण) में कार्यक्रम चला सकते हैं और हरोकू (उत्पादन वातावरण) नहीं।

जैसा कि आप टिप्पणी में उल्लेख करते हैं, आप क्रेडेंशियल सेट करने के लिए ईवीएन का उपयोग कर रहे हैं। आप हेरोकू में ईएनवी सेट करने के लिए इसे 2 तरीकों से सेट कर सकते हैं।

1) में विन्यास लिखें config/production.rb

2) सिफारिश की : ईएनवी को हरोकू कंसोल से सेट करें। यहाँ Ref है। इसे करने के लिए लिंक हरोकू कॉन्फिग वर्जन

आप भी उपयोग कर सकते हैं फिगारो रत्न आपके आवेदन के लिए।

उम्मीद है की वो मदद करदे !