After updating the programming model from ^3.0.0 to ^4.6.0 and the runtime from 3.* to 4.* some functions that has try/catch and early return stop and return timeout.
async function emailValidator(req: HttpRequest): Promise<HttpResponseInit> {
// ...
try {
const email_and_domain = email.split('@')
if (email_and_domain.length < 2 || !isValidEmail(email)) {
throw {
message: `O Email ${email} inválido`,
status: 400,
type: InvalidEmailType.INVALID,
}
}
const email_name = email_and_domain[0]
const email_domain = email_and_domain[1]
const domainAllowedList = await DomainAllowedListModel.findOne({
domain: email_domain,
})
if (domainAllowedList) {
response.status = 200
response.jsonBody = {
isValid: true,
message: `O email ${email} é válido. Está na Lista de Autorizações`,
email,
}
return
}
// code continues...
} catch (err) {
const status = err?.status || 500
const message = err?.message
response.status = status
response.jsonBody = { message, status, ...err }
}
return response
}
The throw works good, also when !domainAllowedList the functions works properly, but when get into the return inside the if, the function stops and gives timeout after a couple minutes.
After updating the programming model from
^3.0.0to^4.6.0and the runtime from3.*to4.*some functions that has try/catch and early return stop and return timeout.The throw works good, also when
!domainAllowedListthe functions works properly, but when get into the return inside the if, the function stops and gives timeout after a couple minutes.