Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Loading Angular ASP.NET app website - Maximum Call Stack Size Exceeded #316

Open
webdjoe opened this issue Oct 8, 2024 · 5 comments

Comments

@webdjoe
Copy link

webdjoe commented Oct 8, 2024

Thank you for this great app, it's incredibly easy to use. One issue I'm having is when I go to an angular ASP.NET app website that normally works in a regular browser and other browser automation tools, it fails to load the page elements with hero. Only the background shows. The console shows the following errors:

ERROR RangeError: Maximum call stack size exceeded
    at [Symbol.hasInstance] (<anonymous>)
    at Array.map (<anonymous>)
    at Array.map (<anonymous>)
    at Array.map (<anonymous>)

Followed by a large number of these errors:

ERROR TypeError: Cannot read properties of null (reading 'startsWith')

Here is the code. The login works because the login page is not an angular app, but once logged in, it only loads the background, but no text or elements.

const GetData = async () => {
    const hero = new Hero({ showChrome: true, showChromeInteractions: true });

    const tab = await hero.goto(SITE_ADDRESS);

    await hero.activeTab.waitForMillis(2000)

    const signIn = await hero.activeTab.querySelector("#signInName")
    const passElem = await hero.activeTab.querySelector("#password")
    const nextButton = await hero.activeTab.querySelector("button#next")

    if (signIn && passElem) {
        await hero.interact({ click: { element: signIn } })
        await hero.interact({ type: USERNAME })
        await hero.interact({ click: { element: passElem } })
        await hero.interact({ type: PASSWORD })
        await hero.interact({ click: { element: nextButton } })
        } else {
            throw  new Error("Log In Elements not found")
        }

    // Throws error because elements do not load
    await hero.waitForElement("#NavItm")
        
    // Code continues
    }
}

Any thoughts on how to resolve?

@blakebyrnes
Copy link
Contributor

I think this might have something to do with the injected scripts we use. Let's see what happens on the next release (should be this week or early next) as a lot of that has been rewritten.

@webdjoe
Copy link
Author

webdjoe commented Oct 12, 2024

@blakebyrnes I don't know if you want me to start a new issue but I tried the new version and I received this error to install chrome-124 but the new cloud release installs chrome 127. I rebuilt the images in a completely fresh environment and it still defaults to 124. I also tried to change userAgent: '~ chrome >= 127 ' which did not have an effect.

If I install the package @ulixee/chrome-124-0 in the cloud environment, it works. Is there a reason this does not work out of the box? Is there a way to force hero to choose a different chrome version or is it baked in?

Error: Error: Failed to launch chrome 124.0.6367.78:

Please re-install the browser engine:
-------------------------------------------------
-------------- NPM INSTALL ----------------------
-------------------------------------------------

 npm install @ulixee/chrome-124-0
...
...
...

I'm running cloud through the shell script:

docker run -it --init \
    --ipc=host \
    --user ulixee \
    --name ulixee-cloud \
    --restart unless-stopped \
    --network hero_net \
    --sysctl net.ipv4.tcp_keepalive_intvl=10 \
    --sysctl net.ipv4.tcp_keepalive_probes=3 \
    --log-opt max-size=20m --log-opt max-file=3 \
    --env-file ${base_dir}/app/.env \
    --security-opt seccomp="$SECURE_PROFILE" \
    -v $DATASTORES_MOUNT:/home/ulixee/.cache/ulixee/datastores \
    -v $DATADIR_MOUNT:/tmp/.ulixee \
    -p "$port:$port" \
    -e DEBUG=$DEBUG \
    -e ULX_HOSTNAME=ulixee-cloud \
    -e ULX_HOSTED_SERVICES_HOSTNAME=0.0.0.0 \
    -e DISPLAY=:99 \
    -d \
    ghcr.io/ulixee/ulixee-cloud:v2.0.0-alpha.30 \
    xvfb-run npx @ulixee/cloud start --port=${port}

Packages.json

{
    "type": "module",
    "dependencies": {
        "@ulixee/hero": "^2.0.0-alpha.30",
        "imap-simple": "^5.1.0",
        "influx": "^5.9.3"
    }
}

@blakebyrnes
Copy link
Contributor

@webdjoe Very strange. It is definitely using chrome-128 by default in the regular package for me. Do you mind confirming that you see that outside of docker? If that's fine, what do you see if you open up and explore the docker? Are chrome 127 and chrome 128 in there as expected? And did the right hero version get packaged up (.30)?

@webdjoe
Copy link
Author

webdjoe commented Oct 12, 2024

It must have reused a layer from a prior build because I fired up a new VM and it is working now. I don't know if it matters, but the chrome version is 127. Here is the package.json from the @ulixee/ulixee-cloud:v2.0.0-alpha.30:

{
  "name": "ulixee",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "@ulixee/chrome-127-0": "^6533.120.11",
    "@ulixee/cloud": "2.0.0-alpha.30"
  }
}

The page still doesn't load with the same error, here is the part of the injected code triggering it. I'm guessing there are too many nested elements due to the page structure.

ObjectCached.keys(console).forEach(key => {
    proxyFunction(console, key, (target, thisArg, args) => {
        if (typedArgs.mode === 'disableConsole')
            return undefined;
        args = replaceErrorStackWithOriginal(args);
        return ReflectCached.apply(target, thisArg, args); // This line is the culprit
    });
});

@blakebyrnes
Copy link
Contributor

It must have reused a layer from a prior build because I fired up a new VM and it is working now. I don't know if it matters, but the chrome version is 127. Here is the package.json from the @ulixee/ulixee-cloud:v2.0.0-alpha.30:

{
  "name": "ulixee",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "private": true,
  "dependencies": {
    "@ulixee/chrome-127-0": "^6533.120.11",
    "@ulixee/cloud": "2.0.0-alpha.30"
  }
}

The page still doesn't load with the same error, here is the part of the injected code triggering it. I'm guessing there are too many nested elements due to the page structure.

ObjectCached.keys(console).forEach(key => {
    proxyFunction(console, key, (target, thisArg, args) => {
        if (typedArgs.mode === 'disableConsole')
            return undefined;
        args = replaceErrorStackWithOriginal(args);
        return ReflectCached.apply(target, thisArg, args); // This line is the culprit
    });
});

Something still weird going on because that code doesn't exist in the latest version and we aren't intercepting console anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants