queue icon indicating copy to clipboard operation
queue copied to clipboard

[InvalidArgumentException] Unknown connection scheme: 'redis'

Open akutaktau opened this issue 5 years ago • 4 comments

I've been trying this plugin for mailing purpose. Somehow I've an issue connecting to redis.

When I'm using predis directly, I can't connect and submit my data to the redis.

This is my stack trace

2021-01-20 08:33:30 Error: [InvalidArgumentException] Unknown connection scheme: 'redis'. in C:\Dev\www\emailtemplate\vendor\predis\predis\src\Connection\Factory.php on line 87
Stack Trace:
- C:\Dev\www\emailtemplate\vendor\predis\predis\src\Client.php:120
- C:\Dev\www\emailtemplate\vendor\predis\predis\src\Client.php:59
- C:\Dev\www\emailtemplate\vendor\enqueue\redis\PRedis.php:126
- C:\Dev\www\emailtemplate\vendor\enqueue\redis\RedisConnectionFactory.php:105
- C:\Dev\www\emailtemplate\vendor\enqueue\redis\RedisConnectionFactory.php:89
- call_user_func - [internal], line ??- C:\Dev\www\emailtemplate\vendor\enqueue\redis\RedisContext.php:160
- C:\Dev\www\emailtemplate\vendor\enqueue\redis\RedisProducer.php:70
- C:\Dev\www\emailtemplate\vendor\enqueue\enqueue\Client\Driver\GenericDriver.php:225
- C:\Dev\www\emailtemplate\vendor\enqueue\enqueue\Client\Driver\GenericDriver.php:62
- C:\Dev\www\emailtemplate\vendor\enqueue\enqueue\Client\Producer.php:121
- C:\Dev\www\emailtemplate\vendor\enqueue\enqueue\Client\Producer.php:53
- C:\Dev\www\emailtemplate\vendor\enqueue\simple-client\SimpleClient.php:185
- C:\Dev\www\emailtemplate\vendor\cakephp\queue\src\QueueManager.php:217
- C:\Dev\www\emailtemplate\vendor\cakephp\queue\src\Mailer\QueueTrait.php:53
- C:\Dev\www\emailtemplate\src\Controller\Api\EmailsController.php:120
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Controller\Controller.php:529
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Controller\ControllerFactory.php:79
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\BaseApplication.php:251
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Runner.php:77
- C:\Dev\www\emailtemplate\vendor\cakephp\authorization\src\Middleware\AuthorizationMiddleware.php:129
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Runner.php:73
- C:\Dev\www\emailtemplate\vendor\cakephp\authentication\src\Middleware\AuthenticationMiddleware.php:122
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Runner.php:73
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Routing\Middleware\RoutingMiddleware.php:166
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Runner.php:73
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Middleware\BodyParserMiddleware.php:174
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Runner.php:73
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Routing\Middleware\RoutingMiddleware.php:166
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Runner.php:73
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Routing\Middleware\AssetMiddleware.php:68
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Runner.php:73
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Error\Middleware\ErrorHandlerMiddleware.php:121
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Runner.php:73
- C:\Dev\www\emailtemplate\vendor\cakephp\debug_kit\src\Middleware\DebugKitMiddleware.php:60
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Runner.php:73
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Runner.php:58
- C:\Dev\www\emailtemplate\vendor\cakephp\cakephp\src\Http\Server.php:90
- C:\Dev\www\emailtemplate\webroot\index.php:40

My configuration look like this.

'DebugKit' => [
        'ignoreAuthorization' => true,
    ],
	
	'Queue' => [
		'default' => [
			  // A DSN for your configured backend. default: null
			  'url' => 'redis:',
			  //'url' => 'redis://127.0.0.1:6397',

			  // The queue that will be used for sending messages. default: default
			  // This can be overriden when queuing or processing messages
			  'queue' => 'default',

			  // The name of a configured logger, default: null
			  'logger' => 'stdout',

			  // The name of an event listener class to associate with the worker
			  //'listener' => \App\Listener\WorkerListener::class,
		]
	],

akutaktau avatar Jan 20 '21 08:01 akutaktau

From the snippet you provided your url is redis: which isn't going to work. I've not used predis before. What are its connection strings supposed to look like?

markstory avatar Jan 20 '21 22:01 markstory

This is my predis code.

<?php
include 'vendor/autoload.php';
require 'vendor/predis/Predis/autoload.php';

Predis\Autoloader::register();
$client = new Predis\Client('tcp://127.0.0.1:6379');
$client->set('foo', 'bar');
$value = $client->get('foo');
echo $value;
?>

I didn't set any password on redis. 127.0.0.1:6379 should be where my redis is running. Currently I'm just following https://book.cakephp.org/queue/1/en/index.html#configuration since the docs is stating using redis.

akutaktau avatar Jan 20 '21 22:01 akutaktau

Try setting the following as your url key when configuring this library:

redis+predis://127.0.0.1:6379/0

josegonzalez avatar Jan 21 '21 04:01 josegonzalez

Try setting the following as your url key when configuring this library:

redis+predis://127.0.0.1:6379/0

i still get the same error message.

'Queue' => [
		'default' => [
			  // A DSN for your configured backend. default: null
			  'url' => 'redis+predis://127.0.0.1:6379/0',
			  //'url' => 'redis://127.0.0.1:6379',

			  // The queue that will be used for sending messages. default: default
			  // This can be overriden when queuing or processing messages
			  'queue' => 'default',

			  // The name of a configured logger, default: null
			  'logger' => 'stdout',

			  // The name of an event listener class to associate with the worker
			  //'listener' => \App\Listener\WorkerListener::class,
		]
	],

By the way I'm using the Queuing Mailer Actions. In case it help to be more specific.

akutaktau avatar Jan 21 '21 09:01 akutaktau