diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/utils/auth-utils.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/utils/auth-utils.js index c1cbbe86b..6236ae72b 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/utils/auth-utils.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/utils/auth-utils.js @@ -21,7 +21,7 @@ export const resolveInheritedAuth = (item, collection) => { ...(item.draft?.request || {}) }; - const authMode = mergedRequest?.auth?.mode; + const authMode = mergedRequest.auth.mode; // If auth is not inherit or no auth defined, return the merged request as is if (!authMode || authMode !== 'inherit') { diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/utils/snippet-generator.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/utils/snippet-generator.js index 1c15080ff..73e03fde6 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/utils/snippet-generator.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/GenerateCodeItem/utils/snippet-generator.js @@ -27,7 +27,7 @@ const generateSnippet = ({ language, item, collection, shouldInterpolate = false // Add auth headers if needed if (request.auth && request.auth.mode !== 'none') { - const authHeaders = getAuthHeaders(collection?.root?.request?.auth, request.auth); + const authHeaders = getAuthHeaders(collection.root.request.auth, request.auth); headers = [...headers, ...authHeaders]; }