From e4e1640272c588cfacca7b7ec14af150ee8f255b Mon Sep 17 00:00:00 2001 From: pablomendezroyo Date: Thu, 7 Nov 2024 10:05:41 +0100 Subject: [PATCH] check has own property --- packages/migrations/src/removeDnsFromComposeFiles.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/migrations/src/removeDnsFromComposeFiles.ts b/packages/migrations/src/removeDnsFromComposeFiles.ts index ad1799f78..6d0aec346 100644 --- a/packages/migrations/src/removeDnsFromComposeFiles.ts +++ b/packages/migrations/src/removeDnsFromComposeFiles.ts @@ -24,7 +24,9 @@ export function removeDnsFromPackageComposeFile(dnpName: string, isCore: boolean for (const serviceName of Object.keys(services)) { const composeService = services[serviceName].get(); - if (composeService.dns) { + // check composeService has the key dns + + if (Object.prototype.hasOwnProperty.call(composeService, "dns")) { logs.info(`Removing DNS from ${serviceName} in ${dnpName} compose file`); // setting undefined a yaml property might result into an error afterwards making js-yaml // adding the following value to the undefined `Error parsing YAML: unknown tag !`