Recent Topics

Graphql api not working



  • When I visit “mywebsite/graphql” page it’s says 404 page not found.

    Also when I run api from postman getting 500 internal server error

    Please help anyone guide me how to use graphql and how to run api’s ??

    Thanks in advance



  • Hi @farhan-saifi ,
    please make sure you have properly installated the package .
    please check the following installation guide:
    https://github.com/bagisto/headless-ecommerce
    also after installation check the graphql playground is working for your instance

    http://example.com/graphql-playground
    

    if its not working then module is not installed proprly.

    Thanks!



  • @Naresh-webkul

    Thanks for help I will try this



  • @Naresh-webkul

    I have tried and it works in local setup. But when i try in server its not working.

    I have uploaded package and update config.php & composer.json file. After when i fire php artisan bagisto_graphql:install its says There are no commands defined in the "bagisto_graphql" namespace.

    I have tried php artisan vendor:publish --force command then php artisan bagisto_graphql:install then all works fine but lighthouse.php in config folder not there.

    Then i upload lighhouse.php file from my local setup then my website goes down. please check log file



  • [2021-10-12 22:12:30] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:192)
    [stacktrace]
    #0 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(118): Illuminate\\Log\\LogManager->resolve(NULL)
    #1 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(98): Illuminate\\Log\\LogManager->get(NULL)
    #2 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(555): Illuminate\\Log\\LogManager->driver()
    #3 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(250): Illuminate\\Log\\LogManager->error('Class 'GraphQL\\\\...', Array)
    #4 /var/www/bagisto/public_html/app/Exceptions/Handler.php(37): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(Error))
    #5 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(414): App\\Exceptions\\Handler->report(Object(Error))
    #6 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(112): Illuminate\\Foundation\\Http\\Kernel->reportException(Object(Error))
    #7 /var/www/bagisto/public_html/public/index.php(89): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
    #8 /var/www/bagisto/public_html/server.php(21): require_once('/var/www/themeo...')
    #9 {main}
    "} 
    [2021-10-12 22:12:30] laravel.ERROR: Class 'GraphQL\Validator\Rules\QueryComplexity' not found {"exception":"[object] (Error(code: 0): Class 'GraphQL\\Validator\\Rules\\QueryComplexity' not found at /var/www/bagisto/public_html/config/lighthouse.php:159)
    [stacktrace]
    #0 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(72): require()
    #1 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php(39): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->loadConfigurationFiles(Object(Illuminate\\Foundation\\Application), Object(Illuminate\\Config\\Repository))
    #2 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\\Foundation\\Bootstrap\\LoadConfiguration->bootstrap(Object(Illuminate\\Foundation\\Application))
    #3 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(152): Illuminate\\Foundation\\Application->bootstrapWith(Array)
    #4 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(136): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
    #5 /var/www/bagisto/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
    #6 /var/www/bagisto/public_html/public/index.php(89): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
    #7 /var/www/bagisto/public_html/server.php(21): require_once('/var/www/themeo...')
    #8 {main}
    "} 
    
    


  • @farhan-saifi said in Graphql api not working:

    But

    please make sure you have follow the below steps for the graph ql installation:

    1. merge the code then run the following commands:
    • composer dump-autoload
    • php artisan config:cache
    1. follow the graphh ql instllation guide in install the graph ql (https://github.com/bagisto/headless-ecommerce)

    There is no need to copy the files from the local ,also as you said above (php artisan vendor:publish --force) for which package you run this command can you please let us know.
    Thanks!


Log in to reply