diff --git a/identity-api/src/m2m.ts b/identity-api/src/m2m.ts index aed9328..cfcf79b 100644 --- a/identity-api/src/m2m.ts +++ b/identity-api/src/m2m.ts @@ -19,8 +19,21 @@ import assert from "node:assert"; import app from "./app.js"; import { ASSET_API_ENDPOINT, ASSET_API_M2M_REFRESH_INTERVAL } from "./consts.js"; -let assetPubKey = await fetchAssetPubkey(); -let assetAlgorithm = await fetchAssetAlgorithm(); +let assetPubKey; +try { + assetPubKey = await fetchAssetPubkey(); +} catch (e) { + console.error("Couldn't retrieve the pubkey from the asset-api. Is the asset-api server running?") + process.exit(1); +} + +let assetAlgorithm; +try { + assetAlgorithm = await fetchAssetAlgorithm(); +} catch (e) { + console.error("Couldn't retrieve the algorithm from the asset-api. Is the asset-api server running?") + process.exit(1); +} setInterval(async () => { try {