# Random timeouts when using ManagementAPI

**URL:** <https://community.auth0.com/t/random-timeouts-when-using-managementapi/97722>\
**Category:** Get Help\
**Tags:** anomaly, management-api\
**Created:** [January 8, 2023, 8:33pm UTC](https://community.auth0.com/t/random-timeouts-when-using-managementapi/97722 "2023-01-08T20:33:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![faabiopk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/faabiopk/32/40579_2.png) [@faabiopk](https://community.auth0.com/u/faabiopk)\
**Post date:** [January 8, 2023, 8:33pm UTC](https://community.auth0.com/t/random-timeouts-when-using-managementapi/97722/1 "2023-01-08T20:33:10Z")

</div>

Hi,

I am using the auth0 JS SDK, version 2.42.0 on a NextJS project.

I have been experiencing problems with the usage of the management API. Some times, and it seems very random from my observations, a given endpoint will time out. The same code will sometimes work, and one F5 later it will freeze timing out on a ManagementAPI call. I am experiencing this in a development environment.

Here is how I am creating the ManagementClient instance:

```auto
    auth0 = await new ManagementClient({
      domain: process.env.AUTH0_ISSUER_BASE_DOMAIN,
      clientId: process.env.AUTH0_CLIENT_ID,
      clientSecret: process.env.AUTH0_CLIENT_SECRET,
      scope: "read:users update:users read:users_app_metadata",
    });
  }

```

And here is an example of call that will sometimes freeze and timeout:

```auto
export default withApiAuthRequired(async function myApiRoute(req, res) {
    const { user } = getSession(req, res);
    const auth0User = await auth0.getUser({ id: user.sub });
   ...
}

```

And finally, the error after timing out:

```auto
error - SanitizedError [APIError]: connect ETIMEDOUT 104.xx.xxx.xxx:443
    at C:\my_project\node_modules\rest-facade\src\Client.js:402:25
    at Request.callback (C:\my_project\node_modules\superagent\lib\node\index.js:905:3)
    at ClientRequest.<anonymous> (C:\my_project\node_modules\superagent\lib\node\index.js:822:12)
    at ClientRequest.emit (node:events:513:28)
    at TLSSocket.socketErrorListener (node:_http_client:494:9)
    at TLSSocket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  statusCode: 'ETIMEDOUT',
  requestInfo: {
    method: 'post',
    url: 'https://dev-xxxxxx.us.auth0.com/oauth/token'
  },

```

I tried using different machines and different internet providers, but no luck.  
Is there some clue of what am I experiencing?

Thanks!

---

<div class="post-metadata">

**Author:** ![faabiopk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/faabiopk/32/40579_2.png) [@faabiopk](https://community.auth0.com/u/faabiopk)\
**Post date:** [January 12, 2023, 12:23am UTC](https://community.auth0.com/t/random-timeouts-when-using-managementapi/97722/2 "2023-01-12T00:23:14Z")

</div>

Maybe an issue with my ISP.  
Using a VPN fixed my problem.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 12, 2023, 1:11pm UTC](https://community.auth0.com/t/random-timeouts-when-using-managementapi/97722/3 "2023-01-12T13:11:03Z")

</div>

Gotchya… I guess we’ve all been there!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 26, 2023, 11:06am UTC](https://community.auth0.com/t/random-timeouts-when-using-managementapi/97722/4 "2023-01-26T11:06:40Z")

</div>


