Version467

    Version467

    6 months ago
    Has anyone successfully setup supertokens with nestjs + graphql? I've had no trouble setting it up for nestjs without graphql, but I'm not able to adapt the supertokens graphql guide to work with the nestjs grapqhl module.
    r

    rp

    6 months ago
    Are you facing any errors specifically? We have had people implement this combination before
    Version467

    Version467

    6 months ago
    The verifySession method in my guard errors out because the request object is undefined.
    r

    rp

    6 months ago
    Hmmm. Are you applying the guard to the graphql endpoint?
    Version467

    Version467

    6 months ago
    Yes. I'm applying the auth middleware to every route, so the graphql endpoint should be included. I probably have to differentiate between http and graphql requests in the guard, because the application context is different. But I'm really not sure.
    r

    rp

    6 months ago
    I see. We will have to look into it a bit. If you open an issue about it on our GitHub, then we can make a demo app for this
    Version467

    Version467

    6 months ago
    I'll try a couple more things, but if I can't get it to run by the end of the day I'll open an issue. Thanks 👍
    r

    rp

    6 months ago
    Sounds good!
    If you do get it to work, feel free to contribute the example to open source 🙂
    Version467

    Version467

    6 months ago
    Got it to work. Accessing the request object is different for the graphql executioncontext. Checking the context type before calling verifySession fixes the issue. I can probably build an example for this. If I do, where can I put it?
    r

    rp

    6 months ago
    You can create a PR for the demo in here: https://github.com/supertokens/supertokens-node/tree/master/examples A folder name like
    nestjs-graphql
    would work well
    Version467

    Version467

    6 months ago
    Alright, sounds good.