Problem
A Nuxt API endpoint performs a long-running task. It begins work, and after 5 minutes, it saves the current state and calls its own HTTP route a second time so a new handler instance can resume work on the saved state.
- Each handler is guaranteed to run at least 10 seconds.
- At most 5 nested calls are made.
- After that, the entire task is marked as
FAILEDand no further nested calls are made.
This causes Vercel to throw a 508 INFINITE_LOOP_DETECTED error after the 4th run:
Question
I’d like to understand how exactly this error is detected. Because, when the individual handlers run the full 5 minutes, the error is now thrown, suggesting there’s some minimum duration they have to run to not being labeled as a loop. If I knew what that lower duration threshold was, I can delay execution to avoid a false positive.
Thank you very much for any help!