Giter VIP home page Giter VIP logo

Comments (14)

4levels avatar 4levels commented on July 19, 2024

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.

chrissm79 avatar chrissm79 commented on July 19, 2024

@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.

kikoseijo avatar kikoseijo commented on July 19, 2024

@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.

deltace avatar deltace commented on July 19, 2024

@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.

kikoseijo avatar kikoseijo commented on July 19, 2024

Its working now, last commit resolves the auth() helper error.

#76

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.

4levels avatar 4levels commented on July 19, 2024

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.

kikoseijo avatar kikoseijo commented on July 19, 2024

from lighthouse.

kikoseijo avatar kikoseijo commented on July 19, 2024

from lighthouse.

4levels avatar 4levels commented on July 19, 2024

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.

4levels avatar 4levels commented on July 19, 2024

To anyone reading this:
see this issue: #85 and this PR #78

from lighthouse.

4levels avatar 4levels commented on July 19, 2024

@alfaproject Please close this issue if the latest master branch fixes the support for Lumen.

from lighthouse.

alfaproject avatar alfaproject commented on July 19, 2024

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.

4levels avatar 4levels commented on July 19, 2024

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.

chrissm79 avatar chrissm79 commented on July 19, 2024

Thanks for testing @4levels!

from lighthouse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.