hi there i am trying to get the user info but getting 404 error in next js please anyone tell me w...
a
hi there i am trying to get the user info but getting 404 error in next js please anyone tell me what i am doing wrong i am refering this doc - https://supertokens.com/docs/thirdpartypasswordless/common-customizations/get-user-info and here is my code
r
hey @ankit0panchal what do you mean by getting 404? You will have to give more detilas..
a
just tell me one thing how can we get the user info on user browser using the user id in next js?
r
You have to make your own api which returns that info.
a
is it possible with sdk because i found some methods and here i am getting the id but not able to getting the user information getting 500 error here is my code snippit
Copy code
import supertokens from "supertokens-node"
import { SessionRequest  } from "supertokens-node/framework/express"
import { superTokensNextWrapper } from "supertokens-node/nextjs"
import { verifySession  } from "supertokens-node/recipe/session/framework/express"

import { backendConfig } from "../../../supertokens-config/backendConfig"

supertokens.init(backendConfig())
export default async function handler(req: SessionRequest, res: any) {
    await superTokensNextWrapper(
        async (next) => {
            await verifySession()(req, res, next)
        },
        req,
        res
    )

    let userId = req.session!.getUserId()
    let userInfo = await supertokens.getUser(userId)

    console.log("$#userInfo $#", userInfo)

    return res.status(200).json({
        userInfo,
    })
}
r
What’s the error stack for the 500 error? Is it from the core or your api?
a
error - Error: The running SuperTokens core version is not compatible with this NodeJS SDK. Please visit https://supertokens.io/docs/community/compatibility to find the right versions
r
are you using self hosted core?
a
yes self hosted
r
you have to update the core
a
how?
r
see core changelog in github
a
i updated the core but still getting same error
r
you must have made soms mistake somewhere.. since this is self hosted, not sure how i can help here.
a
we have the api end point and api key so it there any route where can get the info by user id
r
there isn't. There are backend functions which return this, and you have to create your own API on the backend to return that info to the frontend
there are core apis.. but not apis exposed by the backend sdk
a
so tell me how user can see his login informations,
7 Views