diff --git a/indexer-js-queue-handler/latest-post-metrics-writer.js b/indexer-js-queue-handler/latest-post-metrics-writer.js index 3ac09ae62..c1cd58706 100644 --- a/indexer-js-queue-handler/latest-post-metrics-writer.js +++ b/indexer-js-queue-handler/latest-post-metrics-writer.js @@ -18,7 +18,13 @@ export const handler = async () => { }), }); - const [{ blockHeight }] = await response.json(); + const body = await response.text(); + + if (response.status !== 200) { + throw new Error(body); + } + + const [{ blockHeight }] = JSON.parse(body); await metrics.putBlockHeight("social.near", "posts", blockHeight); };