diff --git a/packages/api-page-builder/src/graphql/crud/pages.crud.ts b/packages/api-page-builder/src/graphql/crud/pages.crud.ts index cf4cad3bfd7..83adb256a25 100644 --- a/packages/api-page-builder/src/graphql/crud/pages.crud.ts +++ b/packages/api-page-builder/src/graphql/crud/pages.crud.ts @@ -548,7 +548,11 @@ export const createPageCrud = (params: CreatePageCrudParams): PagesCrud => { // Delete template-related data. const allTemplateVariableIds = processedPage .content!.data.template.variables.map((variablesForBlock: Record) => { - return variablesForBlock.variables.map((v: Record) => v.id); + if (Array.isArray(variablesForBlock.variables)) { + return variablesForBlock.variables.map((v: Record) => v.id); + } + + return []; }) .flat();