guillaumebriday / laravel-blog

Laravel 11.0 blog application with Hotwire, Horizon, Telescope, Sanctum, Breeze and Pusher
https://laravel-blog.guillaumebriday.fr
MIT License
1.75k stars 572 forks source link

saving a comment triggers error in laravel.log #94

Closed joaopmmartins closed 5 years ago

joaopmmartins commented 5 years ago

I am getting the following error whenever I try to make a comment on a post by clicking the 'comment' button. Any idea why? Many thanks.

[2019-09-23 05:03:25] local.ERROR: php_network_getaddresses: getaddrinfo failed: Name or service not known [tcp://redis:6379] {"userId":1,"exception":"[object] (Predis\Connection\ConnectionException(code: 0): php_network_getaddresses: getaddrinfo failed: Name or service not known [tcp://redis:6379] at /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Connection/AbstractConnection.php:155) [stacktrace]

0 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Connection/StreamConnection.php(128): Predis\Connection\AbstractConnection->onConnectionError('php_network_get...', 0)

1 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Connection/StreamConnection.php(178): Predis\Connection\StreamConnection->createStreamSocket(Object(Predis\Connection\Parameters), 'tcp://redis:637...', 4)

2 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Connection/StreamConnection.php(100): Predis\Connection\StreamConnection->tcpStreamInitializer(Object(Predis\Connection\Parameters))

3 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Connection/AbstractConnection.php(81): Predis\Connection\StreamConnection->createResource()

4 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Connection/StreamConnection.php(258): Predis\Connection\AbstractConnection->connect()

5 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Connection/AbstractConnection.php(180): Predis\Connection\StreamConnection->connect()

6 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Connection/StreamConnection.php(288): Predis\Connection\AbstractConnection->getResource()

7 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Connection/StreamConnection.php(394): Predis\Connection\StreamConnection->write('*2\

\ $4\ \ INCR\ \ $...')

8 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Connection/AbstractConnection.php(110): Predis\Connection\StreamConnection->writeRequest(Object(Predis\Command\StringIncrement))

9 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Client.php(331): Predis\Connection\AbstractConnection->executeCommand(Object(Predis\Command\StringIncrement))

10 /home/linuxtechi/Websites/laravel-blog/vendor/predis/predis/src/Client.php(314): Predis\Client->executeCommand(Object(Predis\Command\StringIncrement))

11 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(111): Predis\Client->__call('incr', Array)

12 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(211): Illuminate\Redis\Connections\Connection->command('incr', Array)

13 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/horizon/src/Repositories/RedisJobRepository.php(81): Illuminate\Redis\Connections\Connection->__call('incr', Array)

14 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/horizon/src/JobId.php(27): Laravel\Horizon\Repositories\RedisJobRepository->nextJobId()

15 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/horizon/src/RedisQueue.php(167): Laravel\Horizon\JobId::generate()

16 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php(154): Laravel\Horizon\RedisQueue->getRandomId()

17 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Queue/Queue.php(88): Illuminate\Queue\RedisQueue->createPayloadArray(Object(Illuminate\Broadcasting\BroadcastEvent), 'queues:default', '')

18 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Queue/RedisQueue.php(91): Illuminate\Queue\Queue->createPayload(Object(Illuminate\Broadcasting\BroadcastEvent), 'queues:default', '')

19 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/horizon/src/RedisQueue.php(46): Illuminate\Queue\RedisQueue->push(Object(Illuminate\Broadcasting\BroadcastEvent), '', NULL)

20 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Queue/Queue.php(44): Laravel\Horizon\RedisQueue->push(Object(Illuminate\Broadcasting\BroadcastEvent), '', NULL)

21 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastManager.php(128): Illuminate\Queue\Queue->pushOn(NULL, Object(Illuminate\Broadcasting\BroadcastEvent))

22 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(267): Illuminate\Broadcasting\BroadcastManager->queue(Object(App\Events\CommentPosted))

23 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(190): Illuminate\Events\Dispatcher->broadcastEvent(Object(App\Events\CommentPosted))

24 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Broadcasting/PendingBroadcast.php(57): Illuminate\Events\Dispatcher->dispatch('App\\Events\\Comm...')

25 /home/linuxtechi/Websites/laravel-blog/app/Http/Controllers/Api/V1/PostCommentController.php(38): Illuminate\Broadcasting\PendingBroadcast->__destruct()

26 [internal function]: App\Http\Controllers\Api\V1\PostCommentController->store(Object(App\Http\Requests\Api\CommentsRequest), Object(App\Models\Post))

27 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)

28 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('store', Array)

29 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/Route.php(219): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\Api\V1\PostCommentController), 'store')

30 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/Route.php(176): Illuminate\Routing\Route->runController()

31 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(680): Illuminate\Routing\Route->run()

32 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))

33 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Auth/Middleware/EnsureEmailIsVerified.php(29): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

34 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Auth\Middleware\EnsureEmailIsVerified->handle(Object(Illuminate\Http\Request), Object(Closure))

35 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

36 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))

37 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

38 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Routing\Middleware\ThrottleRequests->handle(Object(Illuminate\Http\Request), Object(Closure), 60, '1')

39 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(43): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

40 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure), 'api')

41 /home/linuxtechi/Websites/laravel-blog/vendor/spatie/laravel-cors/src/Cors.php(28): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

42 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Spatie\Cors\Cors->handle(Object(Illuminate\Http\Request), Object(Closure))

43 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

44 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(682): Illuminate\Pipeline\Pipeline->then(Object(Closure))

45 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(657): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))

46 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(623): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))

47 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(612): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))

48 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))

49 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))

50 /home/linuxtechi/Websites/laravel-blog/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(65): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

51 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure))

52 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

53 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

54 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

55 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

56 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

57 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))

58 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

59 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))

60 /home/linuxtechi/Websites/laravel-blog/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

61 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))

62 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))

63 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))

64 /home/linuxtechi/Websites/laravel-blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))

65 /home/linuxtechi/Websites/laravel-blog/public/index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

66 {main}

"}

guillaumebriday commented 5 years ago

Hey,

It seems that your redis container is not up. Do you use Docker in the first place?

Thanks

joaopmmartins commented 5 years ago

Hi, I am using the app without Docker. Could you point me in the right direction? Thanks. On Monday, 23 September 2019, 07:06:08 BST, Guillaume Briday notifications@github.com wrote:

Hey,

It seems that your redis container is not up. Do you use Docker in the first place?

Thanks

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

guillaumebriday commented 5 years ago

As you can see here tcp://redis:6379, php try to connect to a docker container for Redis. If you don't want to use Docker you can but you must configure the redis service on your own.

joaopmmartins commented 5 years ago

I replaced REDIS_HOST=redis with REDIS_HOST=localhost in the .env file php artisan config:clear and it fixed the error. Thanks.