Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh Boilerplate Install, Cannot get it to work. #2

Open
julesmons opened this issue Oct 9, 2018 · 21 comments
Open

Fresh Boilerplate Install, Cannot get it to work. #2

julesmons opened this issue Oct 9, 2018 · 21 comments

Comments

@julesmons
Copy link

julesmons commented Oct 9, 2018

When navigated to /graphql, the following error is presented:

Argument 2 passed to Nuwave\Lighthouse\Schema\Extensions\ExtensionRequest::__construct() must be of the type string, null given, called in C:\api\vendor\nuwave\lighthouse\src\Support\Http\Controllers\GraphQLController.php on line 41

Also in GraphQL Playground the following error is presented because it loads the error page:

{
  "error": "Unexpected token < in JSON at position 0"
}

Localhost,
Windows 10,
PHP 7.2.1,
Chrome 69.0.3497.100

@kikoseijo
Copy link
Owner

Dont use the embedded one, use the GRaphql Playground as its a standalone app and works better.
Hope it works for you,

@julesmons
Copy link
Author

julesmons commented Oct 10, 2018

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.

@julesmons
Copy link
Author

julesmons commented Oct 10, 2018

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

@kikoseijo
Copy link
Owner

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.

@julesmons
Copy link
Author

But the fact still stands that GraphQL Playground does not find a scheme. The API boilerplate still doesnt work for me

@julesmons
Copy link
Author

A Screenshot of GraphQL Playground

image

@kikoseijo
Copy link
Owner

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 ,

@kikoseijo kikoseijo reopened this Oct 10, 2018
@kikoseijo
Copy link
Owner

kikoseijo commented Oct 10, 2018

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)

@julesmons
Copy link
Author

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

@kikoseijo
Copy link
Owner

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.

@kikoseijo
Copy link
Owner

Have updated composer, and I got it working.

screen shot 2018-10-11 at 15 47 12

@kikoseijo
Copy link
Owner

screen shot 2018-10-11 at 15 48 14

@julesmons
Copy link
Author

I have opened the console window inside GraphQL Playground and got the following errors.

In the network tab
image

In the console window
image

I have done composer install && composer update. I will try to update composer itself and let you know if it works.

@julesmons
Copy link
Author

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:

image

In GraphQL playground i am still getting the following errors, they are diffrent than te ones i mentioned earlier:

image

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

@jaspacheco
Copy link

jaspacheco commented Oct 11, 2018 via email

@julesmons
Copy link
Author

julesmons commented Oct 11, 2018

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

As referenced in the steps above, i did not miss migrations nor database connections in the .env file.

image

image

The schema also isn't empty, these are the contents from app/GraphQL/schema.graphql:

image

@kikoseijo
Copy link
Owner

<?php

namespace App\GraphQL\Scalars;


use Nuwave\Lighthouse\Schema\Types\Scalars\DateTime as LightDateTime;


class DateTime extends LightDateTime
{

}

@kikoseijo
Copy link
Owner

kikoseijo commented Oct 11, 2018

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.

@julesmons
Copy link
Author

The PHP code you just shared already exists in the Boilerplate:

image

@julesmons
Copy link
Author

I'll add 2018-04-11 00:47:28 to the created and updated add. Ill let you know it this resolves the issue

@julesmons
Copy link
Author

I have changed the dates in my database:

image

In GraphQL Playground the schema still won't load and the following error is displayed:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants