scalablescripts / auth-api

22 stars 28 forks source link

Cannot register or login #3

Open MarvinKweyu opened 3 years ago

MarvinKweyu commented 3 years ago

A sample request for registration:

email:"nomen@nomen.com"
name:"nomen"
password: "nomen"

The output:

Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] Connection refused (SQL: insert into `users` (`name`, `email`, `password`, `updated_at`, `created_at`) values (?, nomen@nomen.com, $2y$10$Jwi4/QJhBWSj2Dzg2LUymuqZ8aK5ncT5DqYNcMgXJZaAfKWjF1c6i, 2021-08-27 12:27:01, 2021-08-27 12:27:01)) in file /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 678

#0 /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php(752): Illuminate\Database\Connection->runQueryCallback('insert into `us...', Array, Object(Closure))
#1 /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php(732): Illuminate\Database\Connection->tryAgainIfCausedByLostConnection(Object(Illuminate\Database\QueryException), 'insert into `us...', Array, Object(Closure))
#2 /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php(641): Illuminate\Database\Connection->handleQueryException(Object(Illuminate\Database\QueryException), 'insert into `us...', Array, Object(Closure))
#3 /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php(472): Illuminate\Database\Connection->run('insert into `us...', Array, Object(Closure))
#4 /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php(424): Illuminate\Database\Connection->statement('insert into `us...', Array)
#5 /app/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\Database\Connection->insert('insert into `us...', Array)
#6 /app/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2882): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into `us...', Array, 'id')
#7 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1530): Illuminate\Database\Query\Builder->insertGetId(Array, 'id')
#8 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1051): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
#9 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1016): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
#10 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(857): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))
#11 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(799): Illuminate\Database\Eloquent\Model->save()
#12 /app/vendor/laravel/framework/src/Illuminate/Support/helpers.php(263): Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent\{closure}(Object(App\Models\User))
#13 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(800): tap(Object(App\Models\User), Object(Closure))
#14 /app/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(23): Illuminate\Database\Eloquent\Builder->create(Array)
#15 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1885): Illuminate\Database\Eloquent\Model->forwardCallTo(Object(Illuminate\Database\Eloquent\Builder), 'create', Array)
#16 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1897): Illuminate\Database\Eloquent\Model->__call('create', Array)
#17 /app/app/Http/Controllers/AuthController.php(19): Illuminate\Database\Eloquent\Model::__callStatic('create', Array)
#18 /app/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\AuthController->register(Object(Illuminate\Http\Request))
#19 /app/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('register', Array)
#20 /app/vendor/laravel/framework/src/Illuminate/Routing/Route.php(254): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\AuthController), 'register')
#21 /app/vendor/laravel/framework/src/Illuminate/Routing/Route.php(197): Illuminate\Routing\Route->runController()
#22 /app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(692): Illuminate\Routing\Route->run()
#23 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#24 /app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#25 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 /app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(127): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 /app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(103): Illuminate\Routing\Middleware\ThrottleRequests->handleRequest(Object(Illuminate\Http\Request), Object(Closure), Array)
#28 /app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(55): Illuminate\Routing\Middleware\ThrottleRequests->handleRequestUsingNamedLimiter(Object(Illuminate\Http\Request), Object(Closure), 'api', Object(Closure))
#29 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\ThrottleRequests->handle(Object(Illuminate\Http\Request), Object(Closure), 'api')
#30 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 /app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(694): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#32 /app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(669): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#33 /app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#34 /app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#35 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(166): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#36 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#37 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#38 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#39 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#40 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#44 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))
#45 /app/vendor/fruitcake/laravel-cors/src/HandleCors.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#46 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
#47 /app/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#48 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#49 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#50 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#51 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#52 /app/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#53 /app/server.php(21): require_once('/app/public/ind...')
#54 {main}

@scalablescripts Could you clarify on this?

selim-bakir commented 2 years ago

Same issue ... any answer ? thank you

Illuminate\Database\QueryException: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name does not resolve (SQL: insert into users (name, email, password, updated_at, created_at) values (DO, developpeur, $2y$10$xecro9PtP0PeC0w2.tOg5.yKoFLeJSRsc2DICHH87aDamPTOioHd6, 2022-10-12 10:33:24, 2022-10-12 10:33:24)) in file /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php on line 678

0 /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php(638): Illuminate\Database\Connection->runQueryCallback('insert into `us...', Array, Object(Closure))

1 /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php(472): Illuminate\Database\Connection->run('insert into `us...', Array, Object(Closure))

2 /app/vendor/laravel/framework/src/Illuminate/Database/Connection.php(424): Illuminate\Database\Connection->statement('insert into `us...', Array)

3 /app/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\Database\Connection->insert('insert into `us...', Array)

4 /app/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2882): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into `us...', Array, 'id')

5 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1530): Illuminate\Database\Query\Builder->insertGetId(Array, 'id')

6 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1051): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)

7 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1016): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)

8 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(857): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))

9 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(799): Illuminate\Database\Eloquent\Model->save()

10 /app/vendor/laravel/framework/src/Illuminate/Support/helpers.php(263): Illuminate\Database\Eloquent\Builder->Illuminate\Database\Eloquent{closure}(Object(App\Models\User))

11 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(800): tap(Object(App\Models\User), Object(Closure))

12 /app/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php(23): Illuminate\Database\Eloquent\Builder->create(Array)

13 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1885): Illuminate\Database\Eloquent\Model->forwardCallTo(Object(Illuminate\Database\Eloquent\Builder), 'create', Array)

14 /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1897): Illuminate\Database\Eloquent\Model->__call('create', Array)

15 /app/app/Http/Controllers/AuthController.php(19): Illuminate\Database\Eloquent\Model::__callStatic('create', Array)

16 /app/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\AuthController->register(Object(Illuminate\Http\Request))

17 /app/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction('register', Array)

18 /app/vendor/laravel/framework/src/Illuminate/Routing/Route.php(254): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\AuthController), 'register')

19 /app/vendor/laravel/framework/src/Illuminate/Routing/Route.php(197): Illuminate\Routing\Route->runController()

20 /app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(692): Illuminate\Routing\Route->run()

21 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))

22 /app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

23 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))

24 /app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(127): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

25 /app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(103): Illuminate\Routing\Middleware\ThrottleRequests->handleRequest(Object(Illuminate\Http\Request), Object(Closure), Array)

26 /app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(55): Illuminate\Routing\Middleware\ThrottleRequests->handleRequestUsingNamedLimiter(Object(Illuminate\Http\Request), Object(Closure), 'api', Object(Closure))

27 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\ThrottleRequests->handle(Object(Illuminate\Http\Request), Object(Closure), 'api')

28 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

29 /app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(694): Illuminate\Pipeline\Pipeline->then(Object(Closure))

30 /app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(669): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))

31 /app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))

32 /app/vendor/laravel/framework/src/Illuminate/Routing/Router.php(624): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))

33 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(166): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))

34 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))

35 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

36 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

37 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

38 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))

39 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

40 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))

41 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

42 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))

43 /app/vendor/fruitcake/laravel-cors/src/HandleCors.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

44 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))

45 /app/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

46 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))

47 /app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))

48 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\Pipeline\Pipeline->then(Object(Closure))

49 /app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))

50 /app/public/index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))

51 /app/server.php(21): require_once('/app/public/ind...')

52 {main}

gzim324 commented 1 year ago

Make sure that you have the correct configuration in the .env file. In particular, pay attention to the username, password and host. It must agree with the configuration you made in docker-compose.yaml