Resolve OSGi and frontend dependency build failures in AEM Cloud Manager
Adobe Experience Manager as a Cloud Service (AEMaaCS) builds may fail in Cloud Manager when required OSGi packages aren’t exported by a provider bundle at the correct start level or frontend dependencies are misconfigured. To resolve the issue, correct the OSGi bundle dependencies, standardize the frontend package manager and dependency versions, remove duplicate packages, and rerun the pipeline.
Description description
Environment
Adobe Experience Manager as a Cloud Service (AEMaaCS), all versions
Issue/Symptoms
-
Builds succeed locally and in other CI tools but fail in the target environment when run through AEM Cloud Manager.
-
The failure occurs during the Maven/build phase after the UI build completes.
-
OSGi dependency analyzer errors indicate that required packages are imported but aren’t exported by a bundle at the correct start level.
-
Frontend build errors or warnings include:
- Both
package-lock.jsonand Yarn configuration are present, indicating mixed package managers. - Dependency and peer-dependency compatibility warnings involving packages such as
next,yargs,@types/react, andsass. - Deprecated Vite CommonJS (CJS) Node API usage.
- Rollup circular dependency warnings involving modules such as
getLinkedAccounts. - Default Lodash imports flagged by the
optimize-lodash-importsplugin. - Network-related retry messages during dependency resolution.
- Both
Root cause
The build fails because required packages don’t have corresponding OSGi exports in the deployment package. Frontend dependency misconfigurations, including mixed package managers and incompatible dependency versions, also contribute to the failure.
Resolution resolution
Follow the steps below to resolve the issue:
-
Review the OSGi dependency configuration:
- Ensure that all required provider bundles for packages imported by the core bundle are included in the final deployment package.
- Verify that these bundles export the required packages at the correct OSGi start level.
- Remove or refactor imports in the core bundle that are no longer required by the application.
-
Resolve frontend module issues:
- Use a single package manager. If Yarn is intended, remove
package-lock.jsonand reinstall dependencies using Yarn to avoid inconsistencies. - Address Rollup circular dependencies by reviewing imports around affected modules, such as
getLinkedAccounts, and update them to reference the exporting module directly or adjust the RollupmanualChunksconfiguration. - Update Lodash imports to use named imports as recommended by the
optimize-lodash-importsplugin, or adjust the plugin configuration if needed. - Update the Vite configuration to avoid deprecated CJS Node API usage.
- Review and resolve all reported peer-dependency mismatches, such as those involving
ESLint,React, and@babel/core.
- Use a single package manager. If Yarn is intended, remove
-
Remove duplicate versions of packages from the deployment package, retaining only the intended version.
-
Compare the configuration and build logs of a successful pipeline with the failing pipeline to identify any differences in environment or configuration.
-
After making the changes, rerun the Cloud Manager pipeline and review the results to confirm that the build succeeds.