Giter Club home page Giter Club logo

Comments (4)

edubacco avatar edubacco commented on June 14, 2024 1

The issue is reproducible also using the admin dashboard, when you try to edit metadata of a user you get an error and then you cannot access anymore the user

from supertokens-core.

sattvikc avatar sattvikc commented on June 14, 2024

@edubacco the getUser function doesn't required a tenantId. It should be able to get any user within the app, across all tenants. When you say it seems to work only for public tenant, are you getting an UNKNOWN_USER_ID when you pass the userId of the user on customTenant?

from supertokens-core.

edubacco avatar edubacco commented on June 14, 2024

We miss a detail: the bug is related to the "update metadata" recipe.
A test to reproduce it:

import { getTestApp } from "../support/test_app"
import { Express } from "express"
import { expect } from "chai"
import { signInUp, updateUser } from "supertokens-node/recipe/passwordless"
import supertokens from "supertokens-node"
import { inspect } from "node:util"
import { faker } from "@faker-js/faker"
import { updateUserMetadata } from "supertokens-node/recipe/usermetadata"

describe.only("GET /admin/tenantId/users/userId", () => {
	let app: Express

	before(async () => {
		const testApp = await getTestApp()
		app = testApp.app
	})

	it("public ternant works", async () => {
		const publicUserEmail = "[email protected]"
		const publicUser = await signInUp({ tenantId: "public", email: publicUserEmail })

		const foundUser = await supertokens.getUser(publicUser.recipeUserId.getAsString())

		expect(foundUser?.emails).contain(publicUserEmail)
	})

	it.only("custom tenant works", async () => {
		const customUserEmail = "[email protected]"
		const customUser = await signInUp({ tenantId: "ucsc", email: customUserEmail })
		const foundUser1 = await supertokens.getUser(customUser.recipeUserId.getAsString())

		expect(foundUser1?.emails).contain(customUserEmail)

		const responsePhone = await updateUser({
			recipeUserId: customUser.recipeUserId,
			phoneNumber: faker.phone.number().replace(/ /g, ""),
			email: customUserEmail,
		})

		const foundUser2 = await supertokens.getUser(customUser.recipeUserId.getAsString())

		expect(foundUser2?.emails).contain(customUserEmail)

		const responseMetadata = await updateUserMetadata(customUser.recipeUserId.getAsString(), {
			firstName: faker.person.firstName(),
			lastName: faker.person.lastName(),
		})

		const foundUser3 = await supertokens.getUser(customUser.recipeUserId.getAsString())
		console.log(inspect(foundUser3))
		expect(foundUser3?.emails).contain(customUserEmail)
	})
})

from supertokens-core.

rishabhpoddar avatar rishabhpoddar commented on June 14, 2024

This has been fixed in core version >= 8.0

from supertokens-core.

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.