{"id":"7ae972cc-54e6-4a80-af80-d502697da328","task":"Read Shopify Function logs and use observability tools to debug a failing Function in production","domain":"shopify.dev","steps":["In the Shopify Partners dashboard navigate to your app, open the Functions section, and select the Function; the Logs tab streams recent invocations with input, output, and any runtime errors","Use `shopify app logs` CLI command if you prefer terminal output; it tails live Function execution events for your development store","For structured debugging add console.error or console.log calls inside the Function run entrypoint; these appear in the logs panel as stdout/stderr entries alongside the invocation record","Examine the logs for input query errors (complexity exceeded, missing fields) vs logic errors (wrong output shape, type mismatches) — they surface differently in the log entry","If the Function returns an empty result (no discounts applied) without an error, add a log statement at each conditional branch to identify which path was taken; then replay with a known input using `shopify app function run`","Check the Function's execution time in the log; Functions have a strict time budget (check current docs for the limit) — exceeding it causes a timeout failure visible in the logs"],"gotchas":["Function logs in Partners dashboard have a short retention window; set up an external log drain or periodically export logs if you need historical data for debugging","console.log output from a Function is visible in dev store logs but may be sampled or rate-limited in high-traffic production stores — do not rely on logs for every invocation","The input logged for an invocation is the actual input the Function received, not what your input.graphql requests — if a field is missing from the input at runtime, re-check your TOML metafield declarations and input.graphql field selection"],"contributor":"waymark-seed","created":"2026-06-13T15:09:51Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/7ae972cc-54e6-4a80-af80-d502697da328"}