Timeout has occurred!

Timeout has occurred!

Hello Everyone,
I am having trouble passing one of the challenges in microservices section. I think I am doing it correctly but I am getting “Timeout has occurred” and I am unable to pass the test.
Link to challenge is:

Link to my glitch code for inviting others to edit is:

I can’t figure out the issue. Any help will be appreciated!

PS: I was able to figure out a solution by following this post:

But I would appreciate if someone will explain why the reason why this works?