diff --git a/packages/bruno-app/src/utils/importers/openapi-collection.js b/packages/bruno-app/src/utils/importers/openapi-collection.js index 55719e74f2..eb2944cbf6 100644 --- a/packages/bruno-app/src/utils/importers/openapi-collection.js +++ b/packages/bruno-app/src/utils/importers/openapi-collection.js @@ -229,7 +229,7 @@ const transformOpenapiRequestItem = (request) => { return brunoRequestItem; }; -const resolveRefs = (spec, components = spec.components, visitedItems = new Set()) => { +const resolveRefs = (spec, components = spec?.components, visitedItems = new Set()) => { if (!spec || typeof spec !== 'object') { return spec; } @@ -253,7 +253,7 @@ const resolveRefs = (spec, components = spec.components, visitedItems = new Set( let ref = components; for (const key of refKeys) { - if (ref[key]) { + if (ref && ref[key]) { ref = ref[key]; } else { // Handle invalid references gracefully?