managementClient.createUser is not a function error

I am trying to create a user using the managment client sdk , however the error createUser is not a function is being thrown , I did not see anyone else with such an error , so I am not sure what I am doing wrong .

auth0 version → “auth0”: “^4.3.1”,

export const managementClient = new ManagementClient({
  domain: process.env.AUTH0_DOMAIN,
  clientId: process.env.AUTH0_MANAGEMENT_CLIENT_ID,
  clientSecret: process.env.AUTH0_MANAGEMENT_CLIENT_SECRET,
  scope: "update:users",
});

async function createUser(user) {
  const { email, role, password, ...profile } = user;
  const externalData = await managementClient.createUser({ email, password,...DEFAULT_USER_CREATION_PARAMS });
  const internalUser = await User.create({
    externalId: externalData.user_id,
    email: email,
    role,
    profile,
  });
    return internalUser;
}

Hey there @gudlemohamed !

It looks like top level methods including createUser() were removed in node-auth0 v4 in favor of users.create() for example - You can see the full list here.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.