# Fails to import ManagementClient in Typescript on Azure

**URL:** <https://community.auth0.com/t/fails-to-import-managementclient-in-typescript-on-azure/122936>\
**Category:** Get Help\
**Tags:** clients, management-api\
**Created:** [December 13, 2023, 12:30am UTC](https://community.auth0.com/t/fails-to-import-managementclient-in-typescript-on-azure/122936 "2023-12-13T00:30:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![afik-codeflash](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/afik-codeflash/32/52917_2.png) [@afik-codeflash](https://community.auth0.com/u/afik-codeflash)\
**Post date:** [December 13, 2023, 12:30am UTC](https://community.auth0.com/t/fails-to-import-managementclient-in-typescript-on-azure/122936/1 "2023-12-13T00:30:06Z")

</div>

This works locally, but crashes on Azure App Service. I’ve tried every possible way of importing managementclient and it fails. I’m also raising a support issue with my account manager.

auth0-mgmt.ts

```auto
import { ManagementClient } from "auth0"

export async function userNickname(userId: string): Promise<string | null> {
  const m = new ManagementClient({
    domain: process.env.AUTH0_ISSUER_BASE_URL ?? "",
    clientId: process.env.AUTH0_MANAGEMENT_CLIENT_ID ?? "",
    clientSecret: process.env.AUTH0_MANAGEMENT_CLIENT_SECRET ?? "",
  })
  try {
    const user = await m.users.get({ id: userId, fields: "nickname" })
    return user.data?.nickname
  } catch (error) {
    console.log("Error getting user nickname:", error)
    return null
  }
}

```

Here’s the stacktrace:

```auto
023-12-13T00:13:17.886814980Z import { ManagementClient } from "auth0"
2023-12-13T00:13:17.886823080Z ^
2023-12-13T00:13:17.886827981Z
2023-12-13T00:13:17.886832481Z SyntaxError: The requested module 'auth0' does not provide an export named 'ManagementClient'
2023-12-13T00:13:17.886837181Z at ModuleJob._instantiate (node:internal/modules/esm/module_job:131:21)
2023-12-13T00:13:17.886841582Z at async ModuleJob.run (node:internal/modules/esm/module_job:213:5)
2023-12-13T00:13:17.886845982Z at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
2023-12-13T00:13:17.886850682Z at async loadESM (node:internal/process/esm_loader:34:7)
2023-12-13T00:13:17.886858183Z at async handleMainPromise (node:internal/modules/run_main:66:12)
2023-12-13T00:13:17.894145144Z
2023-12-13T00:13:17.894163946Z Node.js v20.9.0

```

Here’s my package.json:

```auto
{
...
  "private": true,
  "type": "module",
...
  "dependencies": {
...
    "auth0": "^4.2.0",

```

---

<div class="post-metadata">

**Author:** ![afik-codeflash](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/afik-codeflash/32/52917_2.png) [@afik-codeflash](https://community.auth0.com/u/afik-codeflash)\
**Post date:** [December 13, 2023, 8:55pm UTC](https://community.auth0.com/t/fails-to-import-managementclient-in-typescript-on-azure/122936/2 "2023-12-13T20:55:57Z")

</div>

Turns out, my Azure App Service box had an old file laying around from a really old deploy, called `auth0.ts`. Wow! Deleting it from `wwwroot` by sshing into the box fixed this issue.

Now to figure out why the `az webapp up` deploy command does _not_ remove old files when it deploys! This is quite crazy – does anyone know why it behaves this way?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [December 27, 2023, 8:56pm UTC](https://community.auth0.com/t/fails-to-import-managementclient-in-typescript-on-azure/122936/3 "2023-12-27T20:56:57Z")

</div>

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