Comments (14)
Hi,
I'm also trying to get this running on a bare Lumen installation, but so far I'm not getting to the point where I can use the graphiql interface.
I already did refactor some minor things (since Lumen has a slightly different approach on service providers and configuration) and since I don't want to use Facades alltogether (IMO facades are userland tools, not library tools).
@kikoseijo Can you elaborate on this? I'm sure you've managed to get this working in Lumen ;-)
@chrissm79 As soon as I have managed to get this running, I'll document and PR my changes so you can evaluate as well. Thanks again for this amazing project!
Kind regards,
Erik
from lighthouse.
@4levels That would be awesome! I haven't used Lumen for projects myself but I completely understand the use case/benefits here and would be more than happy to merge a PR for it!
from lighthouse.
@4levels here you are:
https://github.com/kikoseijo/lumen-lighthouse-graphql
Its working for me, you must think that the endpoint its /graphql
and uses POST
right now whats missing its the auth() helper method, does not comes with Lumen, ill provide a solution for this latter on.
Lumen does not have route:list
either, and its hard to know.
from lighthouse.
@kikoseijo : thank you for your help and for this library which is now available for lumen. I will test your graphql library now. Waiting for new releases ...
from lighthouse.
Its working now, last commit resolves the auth()
helper error.
NOTE: @auth
directive won't work, use middleware and take user from $this->context->user
on resolve method.
@4levels you can use what you want to build the lumen instructions you offered, I left it working using Passport login, the famous Viewer
query and a DateTime Scalar type to resolve Carbon.
Hope it helps you get started.
from lighthouse.
Hi @kikoseijo,
Thanks a million for your example repo!
I did however notice that this requires your ksoft/klaravel package but since I don't need any scaffolding nor crud in the browser, I left it out in my own repo.
However I seem to be running into issues with this: when I try to run the login mutation, I keep getting the following error:
"errors": [
{
"message": "Trying to get property of non-object",
"locations": [
{
"line": 2,
"column": 3
}
]
}
]
Further investigation shows that it seems related to a Directive call, this is what shows up in the lumen.log file (truncated for brevity):
[2018-04-11 13:25:09] production.INFO: GraphQL Error: {"code":0,"message":"Trying to get property of non-object","trace":"#0 vendor/webonyx/graphql-php/src/Executor/Executor.php(855): GraphQL\\Error\\Error::createLocatedError(Object(ErrorException), Object(ArrayObject), Array)
#1 vendor/webonyx/graphql-php/src/Executor/Executor.php(799): GraphQL\\Executor\\Executor->completeValueWithLocatedError(Object(GraphQL\\Type\\Definition\\ObjectType), Object(ArrayObject), Object(GraphQL\\Type\\Definition\\ResolveInfo), Array, Object(ErrorException))
#2 vendor/webonyx/graphql-php/src/Executor/Executor.php(721): GraphQL\\Executor\\Executor->completeValueCatchingError(Object(GraphQL\\Type\\Definition\\ObjectType), Object(ArrayObject), Object(GraphQL\\Type\\Definition\\ResolveInfo), Array, Object(ErrorException))
#3 vendor/webonyx/graphql-php/src/Executor/Executor.php(398): GraphQL\\Executor\\Executor->resolveField(Object(GraphQL\\Type\\Definition\\ObjectType), NULL, Object(ArrayObject), Array)
#4 vendor/webonyx/graphql-php/src/Executor/Executor.php(415): GraphQL\\Executor\\Executor->GraphQL\\Executor\\{closure}(Array, 'login', Array, Object(GraphQL\\Type\\Definition\\ObjectType), NULL, Object(ArrayObject))
#5 vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php(135): GraphQL\\Executor\\Executor->GraphQL\\Executor\\{closure}(Array)
#6 vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php(35): GraphQL\\Executor\\Promise\\Adapter\\SyncPromise->GraphQL\\Executor\\Promise\\Adapter\\{closure}()
#7 vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromiseAdapter.php(140): GraphQL\\Executor\\Promise\\Adapter\\SyncPromise::runQueue()
#8 vendor/webonyx/graphql-php/src/GraphQL.php(236): GraphQL\\Executor\\Promise\\Adapter\\SyncPromiseAdapter->wait(Object(GraphQL\\Executor\\Promise\\Promise))
#9 vendor/nuwave/lighthouse/src/GraphQL.php(122): GraphQL\\GraphQL::executeAndReturnResult(Object(GraphQL\\Type\\Schema), 'mutation loginM...', NULL, Object(Nuwave\\Lighthouse\\Schema\\Context), NULL)
#10 vendor/nuwave/lighthouse/src/GraphQL.php(81): Nuwave\\Lighthouse\\GraphQL->queryAndReturnResult('mutation loginM...', Object(Nuwave\\Lighthouse\\Schema\\Context), NULL, NULL)
#11 vendor/nuwave/lighthouse/src/Support/Http/Controllers/GraphQLController.php(44): Nuwave\\Lighthouse\\GraphQL->execute('mutation loginM...', Object(Nuwave\\Lighthouse\\Schema\\Context), NULL)
#12 [internal function]: Nuwave\\Lighthouse\\Support\\Http\\Controllers\\GraphQLController->query(Object(Illuminate\\Http\\Request))
...
So I'm not really sure where to digg, is this Lighthouse related or are there still underlying Lumen issues?
I have to add that I'm getting this error with and without facades..
Please find also my composer require section below
@chrissm79 is it possible to use the master branch? Or should I stick to the v2 (beta-xx) branch? I'm using the master branch currently from my fork of your repo..
"require": {
"php": ">=7.1.3",
"laravel/lumen-framework": "5.6.*",
"vlucas/phpdotenv": "~2.2",
"nuwave/lighthouse": "dev-master",
"predis/predis": "^1.1",
"illuminate/redis": "^5.6",
"laravel/passport": "^6.0",
"dusterio/lumen-passport": "^0.2.6",
"nordsoftware/lumen-cors": "^2.2"
},
from lighthouse.
from lighthouse.
from lighthouse.
Hi @kikoseijo,
thanks for the quick follow up.
You pointed me in the right direction. Let me explain:
I'm used to using the password grant using a client with credentials that I add to the request so the client_id & client_secret are never passed via public requests.
As soon as I enabled the personal access client grant by simply running passport:install again, everything started working!
Thanks again for your help!
Kind regards,
Erik
from lighthouse.
To anyone reading this:
see this issue: #85 and this PR #78
from lighthouse.
@alfaproject Please close this issue if the latest master branch fixes the support for Lumen.
from lighthouse.
I would prefer if someone else can test and close because I’m not working in the project that led me here. It would be unfair if I close it without testing.
from lighthouse.
Hi @chrissm79,
I think it's safe to close this issue. I'm actively using your latest version with the merged changes for Lumen support etc and you were able to run the tests successfully..
from lighthouse.
Thanks for testing @4levels!
from lighthouse.
Related Issues (20)
- Programmatically defined types cannot be found or overwrited while parsing .graphql file HOT 3
- @guard directive in fields but I always get "Unauthenticated" error. HOT 1
- Multiple queries / mutations in single request stop at first error HOT 3
- I faced issue lighthouse middleware HOT 1
- work with Multiple database connection HOT 1
- NOT_LIKE operator not working HOT 1
- ебаные пидорасы
- Directives for root types HOT 3
- Schema cache leaks memory with Laravel Octane HOT 1
- I have problems with many-to-many connections
- GraphQL integration in Laravel Repository Pattern
- Can not solve multiple file upload
- [FEDERATION] error SATISFIABILITY_ERROR when check the schema HOT 2
- `@in` directive breaks if client sends null HOT 1
- "No query results for model [App\\Models\\Permission]." using @create mutation HOT 4
- When using throttle directive how can the client be informed when they can retry again etc. HOT 3
- `@can` directive improvements HOT 1
- Only allow deletion of related models in nested mutations
- `@can` with `injectArgs: true` doesn't inject args passed as variables HOT 3
- laravel lighthouse graphql getting error Content-Type multipart/form-data HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lighthouse.