diff --git a/scripts/run.sh b/scripts/run.sh index 1d6389a..2de8f82 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -168,8 +168,6 @@ while true; do --ip "${DEPLOYMENT_IP}" \ --lrn "$LRN" \ --min-required-payment ${MIN_REQUIRED_PAYMENT:-0} \ - --atom-payment-address "${ATOM_PAYMENT_ADDRESS:-}" \ - --min-atom-payment ${MIN_ATOM_PAYMENT:-1} \ --config-upload-dir "$UPLOAD_DIRECTORY" \ --private-key-file "$OPENPGP_PRIVATE_KEY_FILE" \ --private-key-passphrase "$OPENPGP_PASSPHRASE" \ diff --git a/src/deployments.ts b/src/deployments.ts index f6921c6..64e396f 100644 --- a/src/deployments.ts +++ b/src/deployments.ts @@ -72,14 +72,18 @@ export class RegHelper { } else { const records = await this.registry.getRecordsByIds([id]); for (const r of records) { - this.cache.set(r.id, r); - if (Array.isArray(r.names)) { - for (const n of r.names) { - this.cache.set(n, r); + // Check if record is not null before accessing its properties + if (r && r.id) { + this.cache.set(r.id, r); + if (Array.isArray(r.names)) { + for (const n of r.names) { + this.cache.set(n, r); + } } } } - return records[0]; + // Return the first non-null record, or null if none found + return records.find(r => r !== null) || null; } } @@ -144,11 +148,13 @@ export class RegHelper { const deploymentsByRequest = new Map(); for (const d of deployments) { - deploymentsByRequest.set(d.attributes.request, d); + if (d && d.attributes?.request) { + deploymentsByRequest.set(d.attributes.request, d); + } } const removalsByRequest = new Map(); for (const rr of removalRequests) { - if (rr.attributes.request) { + if (rr && rr.attributes?.request) { removalsByRequest.set(rr.attributes.request, rr); } } @@ -157,9 +163,21 @@ export class RegHelper { const ret = []; for (const r of requests) { + // Skip null or invalid requests + if (!r || !r.id || !r.createTime) { + console.warn('Skipping invalid request:', r); + continue; + } + const status = new RequestStatus(r.id, r.createTime); ret.push(status); + // Skip if application attribute is missing + if (!r.attributes?.application) { + status.lastState = 'ERROR'; + continue; + } + const app = await this.getRecord(r.attributes.application); if (!app) { status.lastState = 'ERROR';