Symfony Exception

ClientException

HTTP 500 Internal Server Error

Client error: `GET https://api.viapp.com.br/empresa-v2/cardapios/25181030000172/185/normal` resulted in a `404 Not Found` response:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="robots" content="noindex,nofollow,noarchive" (truncated...)

Exception

GuzzleHttp\Exception\ ClientException

  1.         if ($summary !== null) {
  2.             $message .= ":\n{$summary}\n";
  3.         }
  4.         return new $className($message$request$response$previous$handlerContext);
  5.     }
  6.     /**
  7.      * Obfuscates URI if there is a username and a password present
  8.      */
  1.                     static function (ResponseInterface $response) use ($request$bodySummarizer) {
  2.                         $code $response->getStatusCode();
  3.                         if ($code 400) {
  4.                             return $response;
  5.                         }
  6.                         throw RequestException::create($request$responsenull, [], $bodySummarizer);
  7.                     }
  8.                 );
  9.             };
  10.         };
  11.     }
in /app/vendor/guzzlehttp/promises/src/Promise.php :: GuzzleHttp\{closure} (line 204)
  1.                  * itself we get a circular reference. We clear the $handler
  2.                  * here to avoid that memory leak.
  3.                  */
  4.                 $f $handler[$index];
  5.                 unset($handler);
  6.                 $promise->resolve($f($value));
  7.             } elseif ($index === 1) {
  8.                 // Forward resolution values as-is.
  9.                 $promise->resolve($value);
  10.             } else {
  11.                 // Forward rejections down the chain.
  1.         if (!is_object($value) || !method_exists($value'then')) {
  2.             $id $state === self::FULFILLED 2;
  3.             // It's a success, so resolve the handlers in the queue.
  4.             Utils::queue()->add(static function () use ($id$value$handlers) {
  5.                 foreach ($handlers as $handler) {
  6.                     self::callHandler($id$value$handler);
  7.                 }
  8.             });
  9.         } elseif ($value instanceof Promise && Is::pending($value)) {
  10.             // We can just merge our handlers onto the next promise.
  11.             $value->handlers array_merge($value->handlers$handlers);
in /app/vendor/guzzlehttp/promises/src/TaskQueue.php :: GuzzleHttp\Promise\{closure} (line 48)
  1.     public function run()
  2.     {
  3.         while ($task array_shift($this->queue)) {
  4.             /** @var callable $task */
  5.             $task();
  6.         }
  7.     }
  8.     /**
  9.      * The task queue will be run and exhausted by default when the process
  1.     private function invokeWaitFn()
  2.     {
  3.         try {
  4.             $wfn $this->waitFn;
  5.             $this->waitFn null;
  6.             $wfn(true);
  7.         } catch (\Exception $reason) {
  8.             if ($this->state === self::PENDING) {
  9.                 // The promise has not been resolved yet, so reject the promise
  10.                 // with the exception.
  11.                 $this->reject($reason);
  1.     private function waitIfPending()
  2.     {
  3.         if ($this->state !== self::PENDING) {
  4.             return;
  5.         } elseif ($this->waitFn) {
  6.             $this->invokeWaitFn();
  7.         } elseif ($this->waitList) {
  8.             $this->invokeWaitList();
  9.         } else {
  10.             // If there's no wait function, then reject the promise.
  11.             $this->reject('Cannot wait on a promise that has '
  1.         $waitList $this->waitList;
  2.         $this->waitList null;
  3.         foreach ($waitList as $result) {
  4.             do {
  5.                 $result->waitIfPending();
  6.                 $result $result->result;
  7.             } while ($result instanceof Promise);
  8.             if ($result instanceof PromiseInterface) {
  9.                 $result->wait(false);
  1.         if ($this->state !== self::PENDING) {
  2.             return;
  3.         } elseif ($this->waitFn) {
  4.             $this->invokeWaitFn();
  5.         } elseif ($this->waitList) {
  6.             $this->invokeWaitList();
  7.         } else {
  8.             // If there's no wait function, then reject the promise.
  9.             $this->reject('Cannot wait on a promise that has '
  10.                 'no internal wait function. You must provide a wait '
  11.                 'function when constructing the promise to be able to '
  1.         return $this->then(null$onRejected);
  2.     }
  3.     public function wait($unwrap true)
  4.     {
  5.         $this->waitIfPending();
  6.         if ($this->result instanceof PromiseInterface) {
  7.             return $this->result->wait($unwrap);
  8.         }
  9.         if ($unwrap) {
  1.      * @throws GuzzleException
  2.      */
  3.     public function request(string $method$uri '', array $options = []): ResponseInterface
  4.     {
  5.         $options[RequestOptions::SYNCHRONOUS] = true;
  6.         return $this->requestAsync($method$uri$options)->wait();
  7.     }
  8.     /**
  9.      * Get a client configuration option.
  10.      *
Client->request() in /app/app/Helpers/GuzzleHelper.php (line 46)
  1.                 'Content-Type' => 'application/json'
  2.             ]
  3.         ]);
  4.         $reponse =  $client->request($req$url, [
  5.             'form_params' => $body,
  6.             'connect_timeout' => $timeout,
  7.         ]);
  8.         $result $reponse->getBody()->getContents();
  9.         return $result;
  10.     }
GuzzleHelper::makeRequestWithBearer() in /app/app/Http/Controllers/EmpresaController.php (line 100)
  1.     protected function cardapios($cnpj$id_cardapio)
  2.     {
  3.         $url env('URL_VIAPP') . 'empresa-v2/cardapios/' $cnpj '/' $id_cardapio '/normal';
  4.         $dados GuzzleHelper::makeRequestWithBearer('GET'$urlnull$this->token);
  5.         if ($dados) {
  6.             return json_decode($dadostrue);
  7.         }
  8.     }
EmpresaController->cardapios() in /app/app/Http/Controllers/EmpresaController.php (line 184)
  1.         $dados_viapp = ($request->session()->get('dados_viapp'));
  2.         $empresa Empresa::where('cnpj'$cnpj)->first();
  3.         $cardapios $this->cardapios($cnpj$catalogo);
  4.         if(isset($dados_viapp)){
  5.             $dados_viapp['cardapios'] = $cardapios;
  6.         }else{
  7.             $dados_viapp = array();
  8.             $dados_viapp['cardapios'] = $cardapios;
  1.         if (static::isCallableWithAtSign($callback) || $defaultMethod) {
  2.             return static::callClass($container$callback$parameters$defaultMethod);
  3.         }
  4.         return static::callBoundMethod($container$callback, function () use ($container$callback$parameters) {
  5.             return $callback(...array_values(static::getMethodDependencies($container$callback$parameters)));
  6.         });
  7.     }
  8.     /**
  9.      * Call a string reference to a class using Class@method syntax.
in /app/vendor/illuminate/container/Util.php :: Illuminate\Container\{closure} (line 40)
  1.      * @param  mixed  $value
  2.      * @return mixed
  3.      */
  4.     public static function unwrapIfClosure($value)
  5.     {
  6.         return $value instanceof Closure $value() : $value;
  7.     }
  8.     /**
  9.      * Get the class name of the given parameter's type, if possible.
  10.      *
  1.         if ($container->hasMethodBinding($method)) {
  2.             return $container->callMethodBinding($method$callback[0]);
  3.         }
  4.         return Util::unwrapIfClosure($default);
  5.     }
  6.     /**
  7.      * Normalize the given callback into a Class@method string.
  8.      *
  1.             return static::callClass($container$callback$parameters$defaultMethod);
  2.         }
  3.         return static::callBoundMethod($container$callback, function () use ($container$callback$parameters) {
  4.             return $callback(...array_values(static::getMethodDependencies($container$callback$parameters)));
  5.         });
  6.     }
  7.     /**
  8.      * Call a string reference to a class using Class@method syntax.
  9.      *
  1.      *
  2.      * @throws \InvalidArgumentException
  3.      */
  4.     public function call($callback, array $parameters = [], $defaultMethod null)
  5.     {
  6.         return BoundMethod::call($this$callback$parameters$defaultMethod);
  7.     }
  8.     /**
  9.      * Get a closure to resolve the given type from the container.
  10.      *
  1.      */
  2.     protected function callControllerCallable(callable $callable, array $parameters = [])
  3.     {
  4.         try {
  5.             return $this->prepareResponse(
  6.                 $this->call($callable$parameters)
  7.             );
  8.         } catch (HttpResponseException $e) {
  9.             return $e->getResponse();
  10.         }
  11.     }
  1.             return $this->callLumenControllerWithMiddleware(
  2.                 $instance$method$routeInfo$middleware
  3.             );
  4.         } else {
  5.             return $this->callControllerCallable(
  6.                 [$instance$method], $routeInfo[2]
  7.             );
  8.         }
  9.     }
  10.     /**
  1.         if (! method_exists($instance $this->make($controller), $method)) {
  2.             throw new NotFoundHttpException;
  3.         }
  4.         if ($instance instanceof LumenController) {
  5.             return $this->callLumenController($instance$method$routeInfo);
  6.         } else {
  7.             return $this->callControllerCallable(
  8.                 [$instance$method], $routeInfo[2]
  9.             );
  10.         }
  1.     protected function callActionOnArrayBasedRoute($routeInfo)
  2.     {
  3.         $action $routeInfo[1];
  4.         if (isset($action['uses'])) {
  5.             return $this->prepareResponse($this->callControllerAction($routeInfo));
  6.         }
  7.         foreach ($action as $value) {
  8.             if ($value instanceof Closure) {
  9.                 $callable $value->bindTo(new RoutingClosure);
  1.                 return $this->callActionOnArrayBasedRoute($this['request']->route());
  2.             }));
  3.         }
  4.         return $this->prepareResponse(
  5.             $this->callActionOnArrayBasedRoute($routeInfo)
  6.         );
  7.     }
  8.     /**
  9.      * Call the Closure or invokable on the array based route.
  1.             case Dispatcher::NOT_FOUND:
  2.                 throw new NotFoundHttpException;
  3.             case Dispatcher::METHOD_NOT_ALLOWED:
  4.                 throw new MethodNotAllowedHttpException($routeInfo[1]);
  5.             case Dispatcher::FOUND:
  6.                 return $this->handleFoundRoute($routeInfo);
  7.         }
  8.     }
  9.     /**
  10.      * Handle a route found by the dispatcher.
  1.                 if (isset($this->router->getRoutes()[$method.$pathInfo])) {
  2.                     return $this->handleFoundRoute([true$this->router->getRoutes()[$method.$pathInfo]['action'], []]);
  3.                 }
  4.                 return $this->handleDispatcherResponse(
  5.                     $this->createDispatcher()->dispatch($method$pathInfo)
  6.                 );
  7.             });
  8.         } catch (Throwable $e) {
  9.             return $this->prepareResponse($this->sendExceptionToHandler($e));
  10.         }
in /app/vendor/laravel/lumen-framework/src/Routing/Pipeline.php -> Laravel\Lumen\Concerns\{closure} (line 48)
  1.      */
  2.     protected function prepareDestination(BaseClosure $destination)
  3.     {
  4.         return function ($passable) use ($destination) {
  5.             try {
  6.                 return $destination($passable);
  7.             } catch (Throwable $e) {
  8.                 return $this->handleException($passable$e);
  9.             }
  10.         };
  11.     }
in /app/vendor/illuminate/session/Middleware/StartSession.php -> Laravel\Lumen\Routing\{closure} (line 121)
  1.             $this->startSession($request$session)
  2.         );
  3.         $this->collectGarbage($session);
  4.         $response $next($request);
  5.         $this->storeCurrentUrl($request$session);
  6.         $this->addCookieToResponse($response$session);
  1.         if ($this->manager->shouldBlock() ||
  2.             ($request->route() instanceof Route && $request->route()->locksFor())) {
  3.             return $this->handleRequestWhileBlocking($request$session$next);
  4.         }
  5.         return $this->handleStatefulRequest($request$session$next);
  6.     }
  7.     /**
  8.      * Handle the given request within session state.
  9.      *
  1.                         // since the object we're given was already a fully instantiated object.
  2.                         $parameters = [$passable$stack];
  3.                     }
  4.                     $carry method_exists($pipe$this->method)
  5.                                     ? $pipe->{$this->method}(...$parameters)
  6.                                     : $pipe(...$parameters);
  7.                     return $this->handleCarry($carry);
  8.                 } catch (Throwable $e) {
  9.                     return $this->handleException($passable$e);
in /app/vendor/laravel/lumen-framework/src/Routing/Pipeline.php -> Illuminate\Pipeline\{closure} (line 30)
  1.         return function ($stack$pipe) {
  2.             return function ($passable) use ($stack$pipe) {
  3.                 try {
  4.                     $slice parent::carry();
  5.                     return ($slice($stack$pipe))($passable);
  6.                 } catch (Throwable $e) {
  7.                     return $this->handleException($passable$e);
  8.                 }
  9.             };
  10.         };
in /app/vendor/illuminate/pipeline/Pipeline.php -> Laravel\Lumen\Routing\{closure} (line 103)
  1.     {
  2.         $pipeline array_reduce(
  3.             array_reverse($this->pipes()), $this->carry(), $this->prepareDestination($destination)
  4.         );
  5.         return $pipeline($this->passable);
  6.     }
  7.     /**
  8.      * Run the pipeline and return the result.
  9.      *
  1.     {
  2.         if (count($middleware) > && ! $this->shouldSkipMiddleware()) {
  3.             return (new Pipeline($this))
  4.                 ->send($this->make('request'))
  5.                 ->through($middleware)
  6.                 ->then($then);
  7.         }
  8.         return $then($this->make('request'));
  9.     }
  1.                 }
  2.                 return $this->handleDispatcherResponse(
  3.                     $this->createDispatcher()->dispatch($method$pathInfo)
  4.                 );
  5.             });
  6.         } catch (Throwable $e) {
  7.             return $this->prepareResponse($this->sendExceptionToHandler($e));
  8.         }
  9.     }
  1.      * @param  \Symfony\Component\HttpFoundation\Request|null  $request
  2.      * @return void
  3.      */
  4.     public function run($request null)
  5.     {
  6.         $response $this->dispatch($request);
  7.         if ($response instanceof SymfonyResponse) {
  8.             $response->send();
  9.         } else {
  10.             echo (string) $response;
Application->run() in /app/public/index.php (line 28)
  1. | the client's browser allowing them to enjoy the creative
  2. | and wonderful application we have prepared for them.
  3. |
  4. */
  5. $app->run();

Stack Trace

ClientException
GuzzleHttp\Exception\ClientException:
Client error: `GET https://api.viapp.com.br/empresa-v2/cardapios/25181030000172/185/normal` resulted in a `404 Not Found` response:
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta name="robots" content="noindex,nofollow,noarchive"  (truncated...)


  at /app/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
  at GuzzleHttp\Exception\RequestException::create()
     (/app/vendor/guzzlehttp/guzzle/src/Middleware.php:69)
  at GuzzleHttp\Middleware::GuzzleHttp\{closure}()
     (/app/vendor/guzzlehttp/promises/src/Promise.php:204)
  at GuzzleHttp\Promise\Promise::callHandler()
     (/app/vendor/guzzlehttp/promises/src/Promise.php:153)
  at GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
     (/app/vendor/guzzlehttp/promises/src/TaskQueue.php:48)
  at GuzzleHttp\Promise\TaskQueue->run()
     (/app/vendor/guzzlehttp/promises/src/Promise.php:248)
  at GuzzleHttp\Promise\Promise->invokeWaitFn()
     (/app/vendor/guzzlehttp/promises/src/Promise.php:224)
  at GuzzleHttp\Promise\Promise->waitIfPending()
     (/app/vendor/guzzlehttp/promises/src/Promise.php:269)
  at GuzzleHttp\Promise\Promise->invokeWaitList()
     (/app/vendor/guzzlehttp/promises/src/Promise.php:226)
  at GuzzleHttp\Promise\Promise->waitIfPending()
     (/app/vendor/guzzlehttp/promises/src/Promise.php:62)
  at GuzzleHttp\Promise\Promise->wait()
     (/app/vendor/guzzlehttp/guzzle/src/Client.php:187)
  at GuzzleHttp\Client->request()
     (/app/app/Helpers/GuzzleHelper.php:46)
  at App\Helpers\GuzzleHelper::makeRequestWithBearer()
     (/app/app/Http/Controllers/EmpresaController.php:100)
  at App\Http\Controllers\EmpresaController->cardapios()
     (/app/app/Http/Controllers/EmpresaController.php:184)
  at App\Http\Controllers\EmpresaController->indexCardapio()
     (/app/vendor/illuminate/container/BoundMethod.php:36)
  at Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
     (/app/vendor/illuminate/container/Util.php:40)
  at Illuminate\Container\Util::unwrapIfClosure()
     (/app/vendor/illuminate/container/BoundMethod.php:93)
  at Illuminate\Container\BoundMethod::callBoundMethod()
     (/app/vendor/illuminate/container/BoundMethod.php:37)
  at Illuminate\Container\BoundMethod::call()
     (/app/vendor/illuminate/container/Container.php:653)
  at Illuminate\Container\Container->call()
     (/app/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:389)
  at Laravel\Lumen\Application->callControllerCallable()
     (/app/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:355)
  at Laravel\Lumen\Application->callLumenController()
     (/app/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:329)
  at Laravel\Lumen\Application->callControllerAction()
     (/app/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:282)
  at Laravel\Lumen\Application->callActionOnArrayBasedRoute()
     (/app/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:267)
  at Laravel\Lumen\Application->handleFoundRoute()
     (/app/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:237)
  at Laravel\Lumen\Application->handleDispatcherResponse()
     (/app/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:173)
  at Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}()
     (/app/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:48)
  at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}()
     (/app/vendor/illuminate/session/Middleware/StartSession.php:121)
  at Illuminate\Session\Middleware\StartSession->handleStatefulRequest()
     (/app/vendor/illuminate/session/Middleware/StartSession.php:64)
  at Illuminate\Session\Middleware\StartSession->handle()
     (/app/vendor/illuminate/pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
     (/app/vendor/laravel/lumen-framework/src/Routing/Pipeline.php:30)
  at Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}()
     (/app/vendor/illuminate/pipeline/Pipeline.php:103)
  at Illuminate\Pipeline\Pipeline->then()
     (/app/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:426)
  at Laravel\Lumen\Application->sendThroughPipeline()
     (/app/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:175)
  at Laravel\Lumen\Application->dispatch()
     (/app/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php:112)
  at Laravel\Lumen\Application->run()
     (/app/public/index.php:28)