Skip to content

Conversation

@solaris007
Copy link
Member

@solaris007 solaris007 commented Nov 29, 2025

Fix: Configuration Update Issues After Helix-Deploy Update

Problem

After upgrading to @adobe/helix-deploy 13.2.0 with ESBuild bundling, Configuration save operations via Slack commands failed with ConditionalCheckFailedException.

Root Cause

The issue was in @adobe/spacecat-shared-data-access where ConfigurationCollection.create() used incorrect entity name:

// Wrong:
sanitizeIdAndAuditFields('Organization', data)

// Correct:
sanitizeIdAndAuditFields('Configuration', data)

This caused configurationId to remain in the data, resulting in:

  • Configuration versions reusing the same ID
  • Identical pk/sk pairs in DynamoDB
  • Conditional write failures when creating new versions

Changes

Dependencies

  • Upgraded @adobe/helix-deploy from gist version to 13.2.0 (official release)
  • Added npm override to force @adobe/[email protected] - Critical to ensure all transitive dependencies use the same version, preventing ESBuild from bundling multiple copies which would cause duplicate code execution

Test Infrastructure

  • Added test/utils.js to support bundle testing - dynamically loads either bundled or source code based on HELIX_TEST_BUNDLE_NAME
  • Added test:bundle npm script for bundle-specific testing
  • Enhanced test mocks for Configuration and ApiKey entities
  • Updated test/setup-env.js to properly load environment variables with override support

Testing

  • ✅ All existing tests pass
  • ✅ Bundle tests verify Configuration save operations work correctly
  • ✅ Verified against production DynamoDB without conflicts

ESBuild (helix-deploy 13+) was bundling multiple copies of
@adobe/spacecat-shared-data-access when nested dependencies
(tier-client, scrape-client) pulled different versions. This
caused EntityRegistry's static state to be duplicated, resulting
in empty collections and "Cannot read properties of undefined"
errors in production.

Changes:
- Add npm override to force single [email protected] version
- Add AWS SDK packages as direct dependencies (helix-deploy
  externalizes @aws-sdk/* by default)
- Add bundle tests to detect future duplication issues
- Skip bundle tests by default (diagnostic tools)

Root cause: EntityRegistry uses static class fields with
Copilot AI review requested due to automatic review settings November 29, 2025 12:54
@solaris007 solaris007 self-assigned this Nov 29, 2025
@solaris007 solaris007 added the bug Something isn't working label Nov 29, 2025
@codecov
Copy link

codecov bot commented Nov 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot finished reviewing on behalf of solaris007 November 29, 2025 12:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a critical ESBuild bundling issue with helix-deploy 13+ where multiple copies of @adobe/spacecat-shared-data-access were being bundled due to nested dependencies pulling different versions. This caused production failures with EntityRegistry's static state being duplicated, resulting in "Cannot read properties of undefined" errors.

Key changes:

  • Upgrade from gist-based helix-deploy to published version 13.2.0
  • Add npm override to force single version of data-access (2.88.6)
  • Introduce bundle testing infrastructure and diagnostic tests

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
package.json Upgrades helix-deploy to 13.2.0, adds data-access version override (2.88.6), and introduces test:bundle and test:esbuild npm scripts
test/utils.js New utility that conditionally loads bundled artifact or unbundled source based on HELIX_TEST_BUNDLE_NAME environment variable
test/index.test.js Updates import to use test/utils.js instead of direct import from src/index.js for bundle testing compatibility
test/bundle-slack-audit.test.js New diagnostic test suite for Slack audit commands that reproduces bundling issues; skipped by default with extensive debug logging
test/bundle-dataaccess-real.test.js New diagnostic test that validates data-access initialization without mocks; skipped by default with extensive debug logging

@github-actions
Copy link

This PR will trigger a patch release when merged.

@solaris007 solaris007 changed the title fix: prevent data-access duplication in ESBuild bundle fix: config update issues after update of helix-deploy Dec 1, 2025
@solaris007 solaris007 merged commit 1a58875 into main Dec 1, 2025
9 checks passed
@solaris007 solaris007 deleted the fix-esm-bundle branch December 1, 2025 09:27
solaris007 pushed a commit that referenced this pull request Dec 1, 2025
## [1.265.2](v1.265.1...v1.265.2) (2025-12-01)

### Bug Fixes

* config update issues after update of helix-deploy ([#1589](#1589)) ([1a58875](1a58875))
@solaris007
Copy link
Member Author

🎉 This PR is included in version 1.265.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants