May I be hitting a functions timeout without being informed about it?

I’m facing an issue with my app at https://dashing-faun-123bbf.netlify.app.

The app is a Shopify app built with Next.js. When I install my app on a Shopify store when it is running from my localhost, everything works perfectly every time. However, when I deploy my app to Netlify and try installing the app running on Netlify, I’m observing really strange behaviour…

In my code I have created a loop where I call Shopify Admin REST APIs 10 times consecutively - I am retrieving the shop’s themes. This executes well, and I get the following log statements:

GET_THEMES 0
__REST_GET {"path":"themes"}
__REST_RESPONSE {"path":"themes"} [object Object]
GET_THEMES 1
__REST_GET {"path":"themes"}
__REST_RESPONSE {"path":"themes"} [object Object]
...
GET_THEMES 9
__REST_GET {"path":"themes"}
__REST_RESPONSE {"path":"themes"} [object Object]

meaning that each of the 10 times the request goes out and I get a response containing an object.

Now, when I do the same thing with the app running on Netlify, my logs look like this:

GET_THEMES 0
__REST_GET {"path":"themes"}
__REST_RESPONSE {"path":"themes"} [object Object] 1/40
GET_THEMES 1
__REST_GET {"path":"themes"}
__REST_RESPONSE {"path":"themes"} [object Object] 1/40
GET_THEMES 2
__REST_GET {"path":"themes"}
__REST_RESPONSE {"path":"themes"} [object Object] 1/40
GET_THEMES 3
__REST_GET {"path":"themes"}

On the 4th time of executing the fetch, the request goes out, but it returns nothing - neither a successful response, nor an error. Just nothing. And my app just freezes in this state.

I am getting no more logs aside from what is provided above.

Is it at all possible that I am hitting some functions time limit, but am not informed about it in the console? I have seen in other posts in this forum that people see logs like ERROR: Task timed out after 10.01 seconds, but I see nothing like it.

Any idea what might be happening here?

Hey there, @Arturas_Rimkus

Thanks for reaching out and welcome to the Netlify Forums. Can you please share a HAR file? You can DM it to @hrishikesh, who will be monitoring the Forums over the weekend, or upload it to cloud storage and share the link.

Hi @hillary. Thanks for responding. I’ve never worked with a HAR file before, but if I understand correctly from this, it can only be generated on the client-side? As in my case all API calls are done from the server…

We wish to see the client-side HAR file to locate the request that you’re making.

Hi @hrishikesh. My code is running on an api route to which Shopify redirects, so I’m not initiating anything on the client-side.

Having said that, I have found and fixed the cause of my issue. I was executing some code after I was calling res.redirect(path), which (I assume) was terminating any code execution as soon as the redirection has been completed.

Rookie mistake. Apologies for the time wasted, and thanks a lot for the responsiveness!

1 Like

Thanks so much for coming back and letting us know. Glad you are unblocked now. Happy building :rocket: