Nodejs app is getting "JavaScript execution failed: Script timed out"

I have a nodejs app hosted by apigee and exposed as api. I am getting the below timeout error.(504) I have MP timeout as 4 mins. So the api is timeing out after 4 mins. When I execute the api in my local I am getting successful response in 6-8 sec.

Input of the api is swagger here. Most weird thing is this happening for only one input.

{"fault":{"faultstring":"JavaScript execution failed: Script timed out: Script timed out\n at \/organization\/environment\/api\/custom-api-rules\/domain-model-checker.js:155\n at \/organization\/environment\/api\/bin\/apilint.js:39\n at \/organization\/environment\/api\/swagger-validator.js:21\n at emit (events.js:92)\n at _stream_readable.js:943\n at _tickDomainCallback (trireme.js:491)\n at _tickFromSpinner (trireme.js:422)\n","detail":{"errorcode":"scripts.node.ScriptExecutionError"}}}
0 3 185
3 REPLIES 3

Not applicable

It sounds code-related issue as this error typically occurs when there's a script that takes too long to execute. Please ensure that your code is not blocking thread execution for longer than 200ms.

@Diego Zuluaga

When I run the script in local it takes 6-7 sec. I can't make it 200ms. I am wondering why it is taking 4 mins to timeout of JS timeout is 200ms.

Another thing how can i increase the JS execution time? Please note that this is node js, so it doesn't have any javascript callout policy attached.

@Dino

Wondering if you faced the issue before.