Best practice for app / theme / webhook logging

mcroker
Visitor
1 0 0

What's the recommended way to create logs from either a theme or an app.

 

I have a number of calls to an external service in the theme, and I would want to know if the call fails.  Assuming the call gets to the external service, I can track most log events there -  but how do I know if the call fails to reach the external service (e.g. client side code issues, authentication issue, ...).

 

Similarly I am using webhooks to trigger calls to an external service.  How do I know/track webhook call failures?

Reply 1 (1)
SBD_
Shopify Staff
Shopify Staff
1623 227 336

Hey @mcroker,

 

Can you please elaborate on your theme setup? How are you calling the external service?

 

Regarding webhook failures, there are no logs as such, but you'll get an email if a webhook continues to fail. From the docs:

 

Shopify has implemented a five second timeout period and a retry period for subscriptions. Shopify waits five seconds for a response to each request to a webhook. If there is no response, or an error is returned, then Shopify retries the connection 19 times over the next 48 hours. A webhook is deleted if there are 19 consecutive failures.

To avoid timeouts and errors, consider deferring app processing until after the webhook response has been successfully sent.

 

 

Scott | Developer Advocate @ Shopify