gpt4 book ai didi

ruby-on-rails - Redis 不断调用 localhost :6379 even though deployed to Heroku

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

我有一个部署到 Heroku 的 Rails 应用程序,但我终究无法弄清楚为什么它一直想要部署到本地。我什至在我的前端代码(react native)或后端代码中的任何地方都没有 localhost:6379,这是我的 Rails API。

这是我在有新广播时遇到的错误:

Completed 500 Internal Server Error in 111ms (ActiveRecord: 47.1ms)
Redis::CannotConnectError (Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED)):

应用程序.yaml:

`gmail_username: "<email_address>"
gmail_password: "<password>"
AWS_ACCESS_KEY: "<access_key>"
AWS_SECRET_KEY: "<secret_key>"
AWS_BUCKET: "<my_s3_app_bucket>"
REDIS_URL: "<redis_url>"`

电缆.yaml

production:
adapter: redis
url: <long_url_address>
host: <host_from_url>
port: <port_from_url>
password: <password_from_url>

生产.rb:

  config.action_cable.allowed_request_origins = ["https://lynx-v1.herokuapp.com/"]
config.action_cable.url = "wss://lynx-v1.herokuapp.com/cable"
config.web_socket_server_url = "wss://lynx-v1.herokuapp.com/cable"

(我同时设置了 action cable 和 web socket 只是为了测试哪个有效,无论我使用哪个我仍然会收到错误)

/config/initializers/redis.rb

  require "redis"

uri = URI.parse(ENV["REDIS_URL"])
$redis = Redis.new(
:url => ENV["REDIS_URL"],
)

我不知道发生了什么。是某种默认设置让 Redis 寻找本地主机 6379 吗?我一步一步地按照这些步骤操作,但我不断收到此错误。

最佳答案

它又开始工作了。 Rails 应用程序中有一个未完全配置的附加 gem。完成副 gem 的设置后,它又开始工作了。

关于ruby-on-rails - Redis 不断调用 localhost :6379 even though deployed to Heroku,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45250734/

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