Open julesmons opened 5 years ago
Dont use the embedded one, use the GRaphql Playground as its a standalone app and works better. Hope it works for you,
Dont use the embedded one, use the GRaphql Playground as its a standalone app and works better. Hope it works for you,
I am using the standalone one.
There seems to be an error in the PHP as referenced in my OP. If i navigate to localhost:8000/graphql
With Chrome i see that PHP error.
To clear up further uncertainties, i will share my exact steps:
git clone https://github.com/kikoseijo/lumen-lighthouse-graphql.git
cd lumen-lighthouse-graphql
composer install && composer update
copy .env.example .env
(App key inserted into .env)
(MySQL (MariaDB) database created)
(MySQL credentials inserted into .env)
php artisan migrate --seed
php -S localhost:8000 -t public/
(Used Chrome to navigate to http://localhost:8000/
) Lumen version displayed
(Used Chrome to navigate to http://localhost:8000/graphql
First PHP error in OP displayed
(Used standalone GraphQL Playground, set endpoint to http://localhost:8000/graphql
) JSON Error displayed
Localhost, Windows 10, PHP 7.2.1, Chrome 69.0.3497.100
Sorry but Lumen has no user interface, so, that module should be used to send things to, in lumen you cant navigate to things, you have a miss confusion of material. sorry.
But the fact still stands that GraphQL Playground does not find a scheme. The API boilerplate still doesnt work for me
A Screenshot of GraphQL Playground
Im a bit tight on time right now, you are probably right and due to lighthouse updates i might have something broken. Ill find some time to adjust if you cant figure it out, but if you do please let me know to update the boilerplate.
Thanks @julesmons ,
Just remember that you might need to make an schema, im pretty sure most of the setup its needed from the Readme.md
The commands on the setup like making your user model, Also, what looks strange its that your screenshot says that there is no connection to server. (in red, near url)
I have made a scheme, in fact it was provided by the boilerplate. I cloned your zipfile so everything should be setup correctly.
Also in GraphQL Playground is says that there is no connection to the server, but in the command line i can see requests to /graphql being made (by GraphQL Playground) so the server can be reached
I dont think i can find a fix for the PHP errors because i dont know anything about Lighthouse. I also think something is broken because of the updates.
If you do find the time to update the boilerplate i would greatly appreciate that.
Thanks in advance,
Jules
What about coors, you can sort of inspect inside the playground app because its an embedded chrome window with cmd + I on apple. See what the error log you reaching out of the server response, thats not the one provided by playground interface.
Have updated composer, and I got it working.
I have opened the console window inside GraphQL Playground and got the following errors.
In the network tab
In the console window
I have done composer install && composer update
. I will try to update composer itself and let you know if it works.
I have done composer self-update
and did composer install && composer update
and i am still unable to get the API working.
However, the WEB portion of the API is working:
In GraphQL playground i am still getting the following errors, they are diffrent than te ones i mentioned earlier:
The problem now seems to be in NodeFactory.php on line 214. The full error is:
(1/1) TypeError
DateTime::__construct() expects parameter 1 to be string, array given
I believe you missing migrations, database connections, things like this, For me, looks like schema its empty, check config files if the route paths are correct.
To clear up further uncertainties, i will share my exact steps:
- git clone https://github.com/kikoseijo/lumen-lighthouse-graphql.git
- cd lumen-lighthouse-graphql
- composer install && composer update
- copy .env.example .env
- (App key inserted into .env)
- (MySQL (MariaDB) database created)
- (MySQL credentials inserted into .env)
- php artisan migrate --seed
- php -S localhost:8000 -t public/
- (Used Chrome to navigate to
http://localhost:8000/
) Lumen version displayed- (Used Chrome to navigate to
http://localhost:8000/graphql
First PHP error in OP displayed- (Used standalone GraphQL Playground, set endpoint to
http://localhost:8000/graphql
) JSON Error displayedLocalhost, Windows 10, PHP 7.2.1, Chrome 69.0.3497.100
As referenced in the steps above, i did not miss migrations nor database connections in the .env file.
The schema also isn't empty, these are the contents from app/GraphQL/schema.graphql:
<?php
namespace App\GraphQL\Scalars;
use Nuwave\Lighthouse\Schema\Types\Scalars\DateTime as LightDateTime;
class DateTime extends LightDateTime
{
}
Add something like 2018-04-11 00:47:28 to the created_at
and updated_at
from your db record, ill update the seed if this resolves it.
The PHP code you just shared already exists in the Boilerplate:
I'll add 2018-04-11 00:47:28 to the created and updated add. Ill let you know it this resolves the issue
I have changed the dates in my database:
In GraphQL Playground the schema still won't load and the following error is displayed:
When navigated to /graphql, the following error is presented:
Also in GraphQL Playground the following error is presented because it loads the error page: