Error 500 Internal Server Error

GET https://www.droit.kesfood.com/connexion/google

Exceptions

Environment variable not found: "GOOGLE_OAUTH_CLIENT_ID".

Exception

Symfony\Component\DependencyInjection\Exception\ EnvNotFoundException

  1. }
  2. }
  3. if (false === $env) {
  4. if (!$this->container->hasParameter("env($name)")) {
  5. throw new EnvNotFoundException(\sprintf('Environment variable not found: "%s".', $name));
  6. }
  7. $env = $this->container->getParameter("env($name)");
  8. }
  9. }
  1. $prefix = '';
  2. }
  3. $this->resolving[$envName] = true;
  4. try {
  5. return $this->envCache[$name] = $processor->getEnv($prefix, $localName, $this->getEnv);
  6. } finally {
  7. unset($this->resolving[$envName]);
  8. }
  9. }
  1. include_once \dirname(__DIR__, 4).'/vendor/league/oauth2-client/src/Provider/AbstractProvider.php';
  2. include_once \dirname(__DIR__, 4).'/vendor/league/oauth2-client/src/Tool/BearerAuthorizationTrait.php';
  3. include_once \dirname(__DIR__, 4).'/vendor/league/oauth2-google/src/Provider/Google.php';
  4. include_once \dirname(__DIR__, 4).'/vendor/knpuniversity/oauth2-client-bundle/src/DependencyInjection/ProviderFactory.php';
  5. return $container->services['knpu.oauth2.client.google'] = new \KnpU\OAuth2ClientBundle\Client\Provider\GoogleClient((new \KnpU\OAuth2ClientBundle\DependencyInjection\ProviderFactory(($container->services['router'] ?? self::getRouterService($container))))->createProvider('League\\OAuth2\\Client\\Provider\\Google', ['clientId' => $container->getEnv('GOOGLE_OAUTH_CLIENT_ID'), 'clientSecret' => $container->getEnv('GOOGLE_OAUTH_CLIENT_SECRET')], 'app_connect_google_check', [], []), ($container->services['request_stack'] ??= new \Symfony\Component\HttpFoundation\RequestStack()));
  6. }
  7. }
  1. $file .= '.php';
  2. }
  3. $service = require $this->containerDir.\DIRECTORY_SEPARATOR.$file;
  4. return class_exists($class, false) ? $class::do($this, $lazyLoad) : $service;
  5. }
  6. protected function createProxy($class, \Closure $factory)
  7. {
  8. class_exists($class, false) || require __DIR__.'/'.$class.'.php';
  1. $container->loading[$id] = true;
  2. try {
  3. if (isset($container->fileMap[$id])) {
  4. return /* self::IGNORE_ON_UNINITIALIZED_REFERENCE */ 4 === $invalidBehavior ? null : $container->load($container->fileMap[$id]);
  5. } elseif (isset($container->methodMap[$id])) {
  6. return /* self::IGNORE_ON_UNINITIALIZED_REFERENCE */ 4 === $invalidBehavior ? null : $container->{$container->methodMap[$id]}($container);
  7. }
  8. } catch (\Throwable $e) {
  9. unset($container->services[$id], $container->privates[$id]);
  1. */
  2. public function get(string $id, int $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE): ?object
  3. {
  4. return $this->services[$id]
  5. ?? $this->services[$id = $this->aliases[$id] ?? $id]
  6. ?? ('service_container' === $id ? $this : ($this->factories[$id] ?? self::$make ??= self::make(...))($this, $id, $invalidBehavior));
  7. }
  8. /**
  9. * Creates a service.
  10. *
  1. * @throws InvalidOAuth2ClientException
  2. */
  3. public function getClient($key)
  4. {
  5. if (isset($this->serviceMap[$key])) {
  6. $client = $this->container->get($this->serviceMap[$key]);
  7. if (!$client instanceof OAuth2ClientInterface) {
  8. throw new InvalidOAuth2ClientException(\sprintf('Somehow the "%s" client is not an instance of OAuth2ClientInterface.', $key));
  9. }
  10. return $client;
ClientRegistry->getClient('google') in src/Controller/Security/GoogleAuthController.php (line 26)
  1. }
  2. if ('' !== $codeParrainage) {
  3. $request->getSession()->set('oauth_ref_code', $codeParrainage);
  4. }
  5. return $clientRegistry->getClient('google')->redirect(['email', 'profile'], []);
  6. }
  7. #[Route('/connexion/google/check', name: 'app_connect_google_check', methods: ['GET'])]
  8. public function check(): never
  9. {
  1. $this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
  2. $controller = $event->getController();
  3. $arguments = $event->getArguments();
  4. // call controller
  5. $response = $controller(...$arguments);
  6. // view
  7. if (!$response instanceof Response) {
  8. $event = new ViewEvent($this, $request, $type, $response, $event);
  9. $this->dispatcher->dispatch($event, KernelEvents::VIEW);
  1. $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  2. $this->requestStack->push($request);
  3. $response = null;
  4. try {
  5. return $response = $this->handleRaw($request, $type);
  6. } catch (\Throwable $e) {
  7. if ($e instanceof \Error && !$this->handleAllThrowables) {
  8. throw $e;
  9. }
  1. if (!$this->handlingHttpCache) {
  2. $this->resetServices = true;
  3. }
  4. try {
  5. return $this->getHttpKernel()->handle($request, $type, $catch);
  6. } finally {
  7. --$this->requestStackSize;
  8. }
  9. }
  1. ) {
  2. }
  3. public function run(): int
  4. {
  5. $response = $this->kernel->handle($this->request);
  6. $response->send(false);
  7. if (\function_exists('fastcgi_finish_request') && !$this->debug) {
  8. fastcgi_finish_request();
in vendor/autoload_runtime.php -> run (line 32)
  1. $app = $app(...$args);
  2. exit(
  3. $runtime
  4. ->getRunner($app)
  5. ->run()
  6. );
require_once('/home/kesfoov/droit/vendor/autoload_runtime.php') in public/index.php (line 5)
  1. <?php
  2. use App\Kernel;
  3. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  4. return static function (array $context) {
  5. return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
  6. };

Logs

Level Channel Message
DEBUG 06:52:02 php Warning: Zend OPcache API is restricted by "restrict_api" configuration directive
{
    "exception": {
        "severity": 2,
        "file": "/home/kesfoov/droit/vendor/symfony/error-handler/DebugClassLoader.php",
        "line": 318,
        "trace": [
            {
                "file": "/home/kesfoov/droit/vendor/doctrine/doctrine-bundle/src/DoctrineBundle.php",
                "line": 136,
                "function": "loadClass",
                "class": "Symfony\\Component\\ErrorHandler\\DebugClassLoader",
                "type": "->"
            }
        ],
        "count": 46
    }
}
INFO 06:52:02 request Matched route "_profiler".
{
    "route": "_profiler",
    "route_parameters": {
        "_route": "_profiler",
        "_controller": "web_profiler.controller.profiler::panelAction",
        "token": "711aaf"
    },
    "request_uri": "https://www.droit.kesfood.com/_profiler/711aaf",
    "method": "GET"
}

Stack Trace

EnvNotFoundException
Symfony\Component\DependencyInjection\Exception\EnvNotFoundException:
Environment variable not found: "GOOGLE_OAUTH_CLIENT_ID".

  at vendor/symfony/dependency-injection/EnvVarProcessor.php:221
  at Symfony\Component\DependencyInjection\EnvVarProcessor->getEnv('string', 'GOOGLE_OAUTH_CLIENT_ID', object(Closure))
     (vendor/symfony/dependency-injection/Container.php:378)
  at Symfony\Component\DependencyInjection\Container->getEnv('GOOGLE_OAUTH_CLIENT_ID')
     (var/cache/dev/Container4oMmuJU/getKnpu_Oauth2_Client_GoogleService.php:32)
  at Container4oMmuJU\getKnpu_Oauth2_Client_GoogleService::do(object(App_KernelDevDebugContainer), true)
     (var/cache/dev/Container4oMmuJU/App_KernelDevDebugContainer.php:648)
  at Container4oMmuJU\App_KernelDevDebugContainer->load('getKnpu_Oauth2_Client_GoogleService.php')
     (vendor/symfony/dependency-injection/Container.php:221)
  at Symfony\Component\DependencyInjection\Container::make(object(App_KernelDevDebugContainer), 'knpu.oauth2.client.google', 1)
     (vendor/symfony/dependency-injection/Container.php:203)
  at Symfony\Component\DependencyInjection\Container->get('knpu.oauth2.client.google')
     (vendor/knpuniversity/oauth2-client-bundle/src/Client/ClientRegistry.php:43)
  at KnpU\OAuth2ClientBundle\Client\ClientRegistry->getClient('google')
     (src/Controller/Security/GoogleAuthController.php:26)
  at App\Controller\Security\GoogleAuthController->connect(object(Request), object(ClientRegistry))
     (vendor/symfony/http-kernel/HttpKernel.php:183)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:76)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:193)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:34)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:32)
  at require_once('/home/kesfoov/droit/vendor/autoload_runtime.php')
     (public/index.php:5)