Important: ESHOPMAN Entities Not Re-indexed After Soft-Delete Restoration

Understanding Entity Re-indexing After Soft-Delete in ESHOPMAN

The ESHOPMAN platform, a powerful headless commerce solution integrated with HubSpot, relies heavily on efficient data indexing to power storefront searches and Admin API queries. A recent observation within the ESHOPMAN community highlights a critical behavior related to entity restoration after a soft-delete operation. This insight aims to shed light on this specific indexing challenge, ensuring ESHOPMAN users, developers, and merchants are fully aware of its implications for storefront management and data visibility.

The Challenge: Restored Entities Absent from Search Index

When an entity, such as a product, customer, or order, is soft-deleted within ESHOPMAN, the platform's Index Module correctly removes it from the active search index. This ensures that soft-deleted items do not appear in live storefront searches or general API queries. However, a key issue arises when these entities are subsequently restored from their soft-deleted state. While the entity successfully reappears in the base database table, it unfortunately remains permanently absent from the ESHOPMAN search index.

This means that even though an entity is marked as active in the database and accessible via direct database queries, it will not be discoverable through the ESHOPMAN query.index functionality. This directly impacts the search and filtering capabilities of your ESHOPMAN-powered storefronts deployed via HubSpot CMS, as well as any custom applications built using the Store API or Admin API that rely on indexed data.

A significant aspect of this challenge is the lack of error reporting. When an entity is restored, the process completes silently from the index's perspective, providing no indication that the item has failed to re-index. This can lead to confusion and data inconsistencies between the database and the search index, potentially affecting customer experience and operational efficiency.

Technical Context and Implications

This behavior has been observed in ESHOPMAN environments running on Node.js, specifically with PostgreSQL databases. The issue points to a potential gap in the re-indexing mechanism following a restoration event. For developers working with ESHOPMAN's Node.js/TypeScript backend, understanding this behavior is crucial when implementing soft-delete and restore functionalities.

The core of the ESHOPMAN backend, including its indexing capabilities, is defined by its dependencies. The following snippet from a typical ESHOPMAN package.json file illustrates the environment where such issues might manifest:

{  "name": "daogo-backend",  "version": "0.1.0",  "description": "A starter for ESHOPMAN projects.",  "author": "ESHOPMAN Community",  "license": "MIT",  "keywords": [    "sqlite",    "postgres",    "typescript",    "ecommerce",    "headless",    "eshopman"  ],  "scripts": {    "build": "eshopman build",    "seed": "eshopman exec ./src/scripts/seed.ts",    "start": "eshopman start",    "dev": "eshopman develop",    "test:integration:http": "TEST_TYPE=integration:http NODE_OPTI jest --silent=false --runInBand --forceExit",    "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTI jest --silent=false --runInBand --forceExit",    "test:unit": "TEST_TYPE=unit NODE_OPTI jest --silent --runInBand --forceExit"  },  "dependencies": {    "@google-cloud/translate": "^9.3.0",    "@aws-sdk/client-s3": "^3.1022.0",    "@elastic/elasticsearch": "^9.3.4",    "@eshopman/admin-sdk": "2.13.3",    "@eshopman/analytics": "2.13.3",    "@eshopman/event-bus-redis": "2.13.3",    "@eshopman/framework": "2.13.3",    "@eshopman/index": "2.13.3",    "@eshopman/eshopman": "2.13.3",    "@mikro-orm/core": "6.4.16",    "@mikro-orm/knex": "6.4.16",    "@mikro-orm/migrations": "6.4.16",    "@mikro-orm/postgresql": "6.4.16",    "@rollup/rollup-darwin-arm64": "^4.60.1",    "@swc/core-darwin-arm64": "^1.15.21",    "@types/multer": "^2.1.0",    "awilix": "^8.0.1",    "bcrypt": "^6.0.0",    "cloudinary": "^2.9.0",    "ioredis": "^5.7.0",    "jsonwebtoken": "^9.0.2",    "multer": "^2.1.1",    "nodemailer": "^7.0.10",    "pg": "^8.13.0",    "zod": "3.25.76"  },  "devDependencies": {    "@faker-js/faker": "^9.9.0",    "@eshopman/cli": "2.13.3",    "@eshopman/test-utils": "2.13.3",    "@mikro-orm/cli": "6.4.16",    "@swc/core": "1.15.2",    "@swc/jest": "^0.2.36",    "@types/bcrypt": "^6.0.0",    "@types/jest": "^29.5.13",    "@types/jsonwebtoken": "^9.0.10",    "@types/node": "^20.0.0",    "@types/nodemailer": "^7.0.4",    "@types/react": "^18.3.2",    "@types/react-dom": "^18.2.25",    "jest": "^29.7.0",    "prop-types": "^15.8.1",    "react": "^18.2.0",    "react-dom": "^18.2.0",    "ts-node": "^10.9.2",    "typescript": "^5.6.2",    "vite": "^5.2.11",    "yalc": "^1.0.0-pre.53"  },  "engines": {    "node": ">=20"  },  "patchedDependencies": {    "@eshopman/index@2.13.3": "patches/@eshopman%2Findex@2.13.3.patch"  }}

This issue highlights the importance of robust indexing strategies in headless commerce. While ESHOPMAN provides powerful tools for managing your store within HubSpot, understanding the nuances of data flow, especially concerning search indexes, is key to maintaining a seamless customer experience.

What to Expect and Next Steps

The ESHOPMAN community is actively monitoring and investigating this behavior. For now, users should be aware that restoring soft-deleted entities may not automatically make them searchable again. Developers might need to consider manual re-indexing or re-publication routines for critical entities after restoration, depending on the specific implementation and the urgency of the data appearing in search results.

Staying informed about ESHOPMAN updates and community discussions is recommended. As solutions or workarounds become available, they will be shared to ensure the integrity and searchability of all your ESHOPMAN storefront data.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools