gpt4 book ai didi

ruby-on-rails - Sidekiq Twilio Redis 'undefined method ` strip' for nil :NilClass'

转载 作者:可可西里 更新时间:2023-11-01 11:00:51 24 4
gpt4 key购买 nike

我正在使用 sidekiq 和 twilio 在指定时间发送文本。

我的 message_worker.rb 包含以下内容:

class MessageWorker
include Sidekiq::Worker

sidekiq_options retry: false

sidekiq_retries_exhausted do |msg|
Sidekiq.logger.warn "Failed #{msg['class']} with #{msg['args']}: #{msg['error_message']}."
end

def perform(id)
record = Textmessage.find id
@twilio = Twilio::REST::Client.new ENV['ACCOUNT_SID'], ENV['AUTH_TOKEN']

@twilio.account.messages.create(
from: ENV['ACCOUNT_PHONE_NUMBER'],
to: record.phone_number,
body: 'This is your scheduled reminder to view a house.'
)
end
end

我的 redis.rb 包含以下内容:

uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)

我收到以下错误消息(为了便于阅读,我将其隔开):

Completed 200 OK in 245ms (Views: 180.7ms | ActiveRecord: 46.6ms)

2014-04-21T17:...

MessageWorker JID-... INFO: fail: 0.497 sec

2014-04-21T17:04:57.636194+00:00 app[web.1]:...

WARN: {"retry"=>false, "queue"=>"default", "class"=>"MessageWorker", "args"=>[5],

"jid"=>"...", "enqueued_at"=>...}

2014-04-21T17:04:57.636194+00:00 app[web.1]: 2014-04-21T17:04:57Z 5 TID-...

**WARN: undefined method `strip' for nil:NilClass**

2014-04-21T17:04:57.637073+00:00 app[web.1]: 2014-04-21T17:04:57Z 5 TID-...

WARN: /app/vendor/bundle/ruby/2.0.0/gems/twilio-ruby-3.11.5/lib/twilio-
ruby/rest/client.rb:142: in `initialize'

最佳答案

我需要在 ENV 文件中设置我的凭据。格式如下:

heroku config:set GITHUB_USERNAME=joesmith

你也可以查看heroku关于配置变量(config vars)的信息:config vars on heroku

关于ruby-on-rails - Sidekiq Twilio Redis 'undefined method ` strip' for nil :NilClass',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23202775/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com