adobe / acc-js-sdk

A JavaScript SDK for Adobe Campaign Classic
Apache License 2.0
21 stars 20 forks source link

Error with package dependency #75

Open jesney-johny opened 1 year ago

jesney-johny commented 1 year ago

Description

JSDOM is one of the dependencies of adobe/acc-js-sdk package which I am using to make connection to Adobe Campaign in a cdk project. While deploying the application using 'cdk deploy' there is a build error for /xhr-sync-worker.js which occurs at the location node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js

Expected Behaviour

Application building successfully

Actual Behaviour

An error with JSDOM

ERROR   Uncaught Exception  {
    "errorType": "Runtime.ImportModuleError",
    "errorMessage": "Error: Cannot find module './xhr-sync-worker.js'\nRequire stack:\n- /var/task/index.js\n- /var/runtime/index.mjs",
    "stack": [
        "Runtime.ImportModuleError: Error: Cannot find module './xhr-sync-worker.js'",
        "Require stack:",
        "- /var/task/index.js",
        "- /var/runtime/index.mjs",
        "    at _loadUserApp (file:///var/runtime/index.mjs:1000:17)",
        "    at async Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1035:21)",
        "    at async start (file:///var/runtime/index.mjs:1200:23)",
        "    at async file:///var/runtime/index.mjs:1206:1"
    ]
}

Platform and Version

"aws-cdk-lib": "2.35.0" "@adobe/acc-js-sdk": 1.1.17

Sample Code that illustrates the problem

const adobe = require("@adobe/acc-js-sdk");

Don't really know if the issue is with this package or the JSDOM package

Thanks in advance

mkiki commented 1 year ago

Hi @jesney-johny, thanks for the report. It looks indeed to be related to jsdom. I can find the same issue in a different context here: https://stackoverflow.com/questions/44354700/meteor-app-not-finding-xhr-sync-worker-js. Maybe some of the solutions proposed here will work for you. I'll have a look as soon as possible to make sure this works out of the box.

jesney-johny commented 1 year ago

Thanks for the help. For the temporary fix I have updated the npm dependencies using patch-package