LoginSignup
0
0

More than 1 year has passed since last update.

laradockでlaravel-echo-serverを立てたときの "NOAUTH Authentication required" を解決する

Posted at

調べてもなかなか出てこず、別の事象の対応策のようななにかばかり引っかかるのでメモ

概要

laradockを使って

$ docker-compose up -d redis laravel-echo-server

として双方向通信のためのコンテナを準備していると、
なぜかlaravel-echo-serverのほうだけが数秒で落ちてしまう。

ログを見ると

[ioredis] Unhandled error event: ReplyError: NOAUTH Authentication required.

中略

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Redis could not subscribe.".] {
  code: 'ERR_UNHANDLED_REJECTION'
}

というエラー。
書いてあることはわかるんだけどこれの解決策にたどり着くのに数時間要した。

解決策

初期状態だとlaradockの.envにはsecret_redisがredis用のパスワードとして設定されており、
何もいじらずにredisのコンテナを立てるとこのパスワードが適用され、疎通時にも必要になるっぽい。

laradock/.env
### REDIS #################################################

REDIS_PORT=6379
REDIS_PASSWORD=secret_redis ←これ

ので、
laradock/laravel-echo-server/laravel-echo-server.jsondatabaseConfigセクションに

laravel-echo-server.json
			"password":"secret_redis"

を追加してやったあとにlaravel-echo-serverのコンテナを再ビルドする。

$ docker-compose up -d --build laravel-echo-server
✔  Running at localhost on port 6001
✔  Channels are ready.
✔  Listening for http events...
✔  Listening for redis events...

Server ready!

よし。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0