Problem statement
We received the “Request to Webtask exceeded allowed execution time” error from the /authorize
endpoint or the /oauth/token
endpoint.
Cause
The “Request to Webtask exceeded allowed execution time” error means the webtask (e.g. rules/hooks/actions/custom DB scripts) cannot be completed within the execution limit, which is 20 seconds.
The possible causes for the webtask to timeout could be:
- Your webtask code not calling the
callback()
function - Auth0 webtask platform is not responding
- Your webtask calling an external API and the external API timeout
- AWS/Azure cloud outage
Solution
Here is some general guidance on each of the causes.
-
Your webtask code not calling the
callback()
function
The webtask is completed by calling thecallback()
function. If thecallback()
is missing, the webtask will keep running until the execution time runs out, thus the “Request to Webtask exceeded allowed execution time” error is thrown.
If your webtask code has manyif...else...
statements, ensure thecallback()
function is called at the end under every condition. -
Auth0 webtask platform is not responding
If the webtask platform is malfunctioning, that could cause the timeout. It usually impacts multiple tenants or even all the tenants in the same region. Please open a support ticket or create a community topic if that happens. -
If your webtask s an external API and the external API timeout.
Your external API service may be taking too much time or even not responding, which causes the webtask to timeout.
Usually, you would use an NPM package such asaxios
,superagent
,request
, etc, to make the external API calls. These libraries support thetimeout
setting:
- If you are not using the
timeout
setting, the default timeout of these libraries could be 60 seconds (e.g. request) or unlimited (e.g.axios
). So if the external API service times out, the webtask is doomed to timeout. - If you have configured the
timeout
setting to be less than 20 seconds, please check if you are making multiple external API calls in series and if the totaltimeout
settings could exceed 20 seconds. For example, you make 4 external API calls in all the rules in series, each is configured with thetimeout
of 5 seconds, and if all 4 API calls times out, it could cause the webtask to timeout.
- AWS/Azure cloud outage
If neither Auth0 nor your external API service is responsible for the timeout. The cloud infrastructure (e.g. AWS, Azure, or GCP) network blip or outage could cause this error as well.
There are 2 cases:
a) The cloud infrastructure that hosts the Auth0 webtask platform has an outage
b) The cloud infrastructure that hosts your external API service has an outage.
So you may need to search on social media (e.g. Tweet) for AWS outages to know if there is an outage on AWS or use a 3rd-party platform such as https://stop.lying.cloud.