p6l.richard

    p6l.richard

    4 months ago
    What's the recommended way to make the
    NextApiRequest
    and express'
    Request
    types match? I see that in the nextjs example basically works with supertoken's express adapter and imports the
    import { middleware } from 'supertokens-node/framework/express';
    which TypeScript doesn't like.https://github.com/supertokens/next.js/blob/canary/examples/with-supertokens/pages/api/auth/%5B%5B...path%5D%5D.js
    r

    rp

    4 months ago
    hey!
    can you open an issue about this on our github please? I don't think it's possible right now (other than doing what you said or using
    any
    )
    p6l.richard

    p6l.richard

    4 months ago
    sure! I prefer type casting it as of now
    I'm encountering more type issues though, so there might be a few issues that come together I believe
    r

    rp

    4 months ago
    hmm. that is interesting
    p6l.richard

    p6l.richard

    4 months ago
    e.g. your example for
    with-localstorage
    also has some types offhttps://github.com/supertokens/supertokens-auth-react/blob/master/examples/with-localstorage/api-server.js @rp should we pass input.res to the updateHeaders rather than
    session
    ?
    Or is session supposed to contain the
    res
    r

    rp

    4 months ago
    yea.. it's input.res. Not session.res
    p6l.richard

    p6l.richard

    4 months ago
    Okay, should I submit a PR for this?
    r

    rp

    4 months ago
    Yes. Please do. thanks!
    Sorry for bothering you about the types, but when can
    Session.APIInterface.signOutPOST
    be undefined? And morte importantly, how am I supposed to handle it if it is
    undefined
    ? throw an error or return
    undefined
    ?
    r

    rp

    4 months ago
    So it will never be undefined, unless you set it to undefined instead of giving a function
    p6l.richard

    p6l.richard

    4 months ago
    message has been deleted
    r

    rp

    4 months ago
    So you can handle it by throwing an error in the if block - cause it will never come thrrr
    There*
    p6l.richard

    p6l.richard

    4 months ago
    There's also a return missing for the signOutPOST method (expects
    {status: "OK"}
    ) If I get the implementation working, I can add it to the above PR by fixing the example. 😅
    r

    rp

    4 months ago
    Right! Thank you!
    The problem is also that these examples are all in JS. So we will also be converting them to TS sometime soon. Which should point out all these errors
    p6l.richard

    p6l.richard

    4 months ago
    Okay, I have to throw in the towel. I was unable to make supertokens work for my use case 😦
    r

    rp

    4 months ago
    What is your use case?
    p6l.richard

    p6l.richard

    4 months ago
    Making the
    with-localstorage
    example work on nextjs
    r

    rp

    4 months ago
    An right. That is a complex customisation., why do you need to use localstorage?
    r

    rp

    4 months ago
    Ahh I see
    Well yea. It is difficult to customise it for this use case. We will probably have to have a dedicated way of using it for extensions