Issue with Auth0 Management API: "Request to Webtask exceeded allowed execution time"

I encountered an issue while using Auth0 with a custom database. When testing the custom database scripts, everything works as expected. Deleting a user via the Auth0 dashboard also works perfectly. However, when I attempt to delete a user using the Management API, I receive the following error:
Request to Webtask exceeded allowed execution time.

Upon investigating the logs, I noticed that the delete user endpoint in my script is only accessed after the error is thrown.

Could you please help me identify what might be causing this issue? Specifically:

  1. Why is the delete user endpoint not called immediately?
  2. How can I ensure the script executes within the allowed time limit?

Any guidance would be greatly appreciated!

Regarding why the delete user endpoint isn’t called immediately:

  • When using the Management API to delete a user, Auth0 first attempts to perform some internal cleanup operations
  • This includes removing the user from any organizations, revoking refresh tokens, and cleaning up any associated data
  • Only after these operations complete does Auth0 call your custom database delete script
  • If these preliminary operations take too long, the webtask times out before reaching your script

These posts can help you explain why you receiving the error.

https://community.auth0.com/t/request-to-webtask-exceeded-allowed-execution-time-error-from-authorize-endpoint-or-oauth-token-endpoint/104471

If the issue persists, you could consider implementing a queue-based system for user deletion, where the Management API triggers a deletion request that gets processed asynchronously, though this would require additional infrastructure.

Hi @foxfoxbee314,

Welcome back to the Auth0 Community!

Thank you, @sumansaurav, for answering and helping other community members! I would personally add that you can try to debug this using Real-time Webtask Logs Extension.

Thanks
Dawid

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