tlaverdure / laravel-echo-server

Socket.io server for Laravel Echo
MIT License
2.65k stars 510 forks source link

[ioredis] Unhandled error event: Error: Redis parser fatal error #375

Open adriaandebolle opened 5 years ago

adriaandebolle commented 5 years ago

I've tried to instal laravel-echo-server globally with npm install -g laravel-echo-server or with yarn global add laravel-echo-server, but this gave me a ParserError. Then I've tried to use the local package and run a configuration file node server.js, but it gave me the same following error:

L A R A V E L  E C H O  S E R V E R

version 1.5.0

⚠ Starting server in DEV mode...

✔  Running at localhost on port 6001
✔  Channels are ready.
✔  Listening for http events...
[ioredis] Unhandled error event: Error: Redis parser fatal error: ParserError: Protocol error, got "H" as reply type byte
    at parseType (/Applications/MAMP/htdocs/unblnd/node_modules/laravel-echo-server/node_modules/redis-parser/lib/parser.js:305:34)
    at JavascriptRedisParser.execute (/Applications/MAMP/htdocs/unblnd/node_modules/laravel-echo-server/node_modules/redis-parser/lib/parser.js:563:20)
    at Socket.<anonymous> (/Applications/MAMP/htdocs/unblnd/node_modules/laravel-echo-server/node_modules/ioredis/lib/redis/event_handler.js:107:22)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
    at JavascriptRedisParser.returnFatalError (/Applications/MAMP/htdocs/unblnd/node_modules/laravel-echo-server/node_modules/ioredis/lib/redis/parser.js:31:33)
    at handleError (/Applications/MAMP/htdocs/unblnd/node_modules/laravel-echo-server/node_modules/redis-parser/lib/parser.js:204:10)
    at parseType (/Applications/MAMP/htdocs/unblnd/node_modules/laravel-echo-server/node_modules/redis-parser/lib/parser.js:305:14)
    at JavascriptRedisParser.execute (/Applications/MAMP/htdocs/unblnd/node_modules/laravel-echo-server/node_modules/redis-parser/lib/parser.js:563:20)
    at Socket.<anonymous> (/Applications/MAMP/htdocs/unblnd/node_modules/laravel-echo-server/node_modules/ioredis/lib/redis/event_handler.js:107:22)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

This is part of .env:

APP_DEBUG=true
APP_URL=http://localhost

BROADCAST_DRIVER=redis
QUEUE_DRIVER=database
QUEUE_CONNECTION=database
SESSION_DRIVER=database
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6001

Server configuration file:

require('dotenv').config();

const env = process.env;

require('laravel-echo-server').run({
    authHost: env.APP_URL,
    devMode: env.APP_DEBUG,
    database: "redis",
    databaseConfig: {
        redis: {
            host: env.REDIS_HOST,
            port: env.REDIS_PORT,
        }
    }
});
JoseGeorges8 commented 5 years ago

Have you been able to resolve the issue? I'm having the same error and I'm thinking it has to do with the redis config

adriaandebolle commented 5 years ago

No, not yet. I'll probably use temporarily setInterval and ajax, which is a bad idea in comparison to web sockets. When I'd find a solution later on I'll update you :)

pete-rai commented 5 years ago

This rather unhelpful error means that Redis is not running on the target machine. Make sure that you have installed Redis and that it is up and running outside of Laravel before setting up the Echo server.

ch-dani commented 3 years ago

hello guys , have any one of you found the solution of problem cited above. I am stuck to this error for last many days and couldn't resolve. If someone know about this problem please help me.