open-rpa / node-red-contrib-tagui

Mozilla Public License 2.0
8 stars 4 forks source link

Ubuntu error #2

Closed marcelocecin closed 3 years ago

marcelocecin commented 3 years ago

Hi I'm running on Ubuntu for the first time as attached, the extraction of the zip stopped photo_2021-05-31_15-03-53 and now when trying to run it happens the following steps:

I am running the standard script

marcelocecin commented 3 years ago

now is another error

skadefro commented 3 years ago

is the prerequest installed ? What error are you getting in the nodered console ?

RUN apt-get update \
    && apt-get install -y unzip wget gnupg python3-pip python3-venv php \
    && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
    && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
    && apt-get update \
    && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \
    --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*
marcelocecin commented 3 years ago

yes, because I already used tagui on this machine, after I installed node-red

skadefro commented 3 years ago

@kensoh any idea ?

kensoh commented 3 years ago

Hi @skadefro and @marcelocecin, it looks like the issue of hangs at extraction is resolved.

I assume the error message is after processing by the Node-RED module. If yes, then the error message is from below. It happens when TagUI can't write to the tagui/src folder. This is suggesting for some reason, the user permissions of the Node-RED process can't create the files there. This is strange given the module extracts the folder there. Unless for some reason maybe the folder and files there have the immutable flag (can be checked with lsattr command)

tagui_parse.php:if (!touch('tagui_chrome.in')) die("ERROR - cannot initialise tagui_chrome.in\n");
tagui_parse.php:if (!touch('tagui_chrome.out')) die("ERROR - cannot initialise tagui_chrome.out\n");}

Assuming the extraction folder is ~/tagui, Marcelo you can explore the following ideas -

  1. do a lsattr from ~/tagui/src folder to see if any immutable files (this means files can't be deleted even by root)
  2. Run ~/tagui/src/tagui ~/tagui/flows/samples/1_google.tag to see what happens when run manually
  3. Double check that PHP is installed with php -v (it should be, given the error message you have)
  4. Check if you are running as root. For Chrome/Chromium to run as root need --disable-gpu hack, for eg here - https://colab.research.google.com/drive/13bQO6G_hzE1teX35a3NZ4T5K-ICFFdB5?usp=sharing
Google Colaboratory
marcelocecin commented 3 years ago

Hey guys would it not be possible for node-red to try to recognize if tagui is installed in the path /usr/local/bin/tagui ? according to documentation https://tagui.readthedocs.io/en/latest/setup.html thanks

Installation — TagUI 6.14.0 documentation
skadefro commented 3 years ago

That kind of makes sense ... But according to the guide tagui should be in ~/tagui ( and ~/.tagui for the python version ) so that is what we are checking .. but yes you could have placed tagui somewhere else and still registered the command in /usr/local/bin/tagui

marcelocecin commented 3 years ago

cdj@rpa:~/tagui$ php -v PHP 7.4.18 (cli) (built: May 3 2021 11:27:06) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.18, Copyright (c), by Zend Technologies

marcelocecin commented 3 years ago

cdj@rpa:~/tagui$ lsattr --------------e----- ./flows --------------e----- ./src --------------e----- ./docs --------------e----- ./LICENSE.md --------------e----- ./README.md

kensoh commented 3 years ago

Looks like PHP and immutable is not the cause. How does running manually result in?

  1. Run ~/tagui/src/tagui ~/tagui/flows/samples/1_google.tag to see what happens when run manually

Also, today there is false-positive on tagui_chromep.php by AVG Anti-virus / Internet Security so it will delete the file. if you are using that, need to add manually to exception while waiting for my whitelisting application approval - https://github.com/kelaberetiv/TagUI/issues/1044

marcelocecin commented 3 years ago

when I run ~/tagui/src/tagui ~/tagui/flows/samples/1_google.tag the script runs normally

marcelocecin commented 3 years ago

now the error changed to: "Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)"

kensoh commented 3 years ago

I see, I have no other ideas to explore for now. Looks like this error appears when browser crash, but no idea why browser can crash - https://github.com/puppeteer/puppeteer/issues/4428

Hi Allan, for installation of TagUI, I think there are pros and cons of using user's installed TagUI. For RPA for Python, it is based on a forked version optimised for that package purpose, so I have to do an actual installation separate from user's. Doing separate has better control of the Node-RED module behaviour, but using user's one would be more intuitive for user.

marcelocecin commented 3 years ago

hey Ken, which platform uses puppeteer?

kensoh commented 3 years ago

Oh Puppeteer is popular tool by Google for automating websites, used by many. It's based in NodeJS.

The tool talks directly to Chrome using websocket and DevTools protocol, similar what TagUI does.

marcelocecin commented 3 years ago

I think I formulated my question wrongly: does the node-red or tagui use the puppeter?

skadefro commented 3 years ago

No.

kensoh commented 3 years ago

I see.. I was pointing that Chrome error message to highlight that similar issue is also happening for other apps.

For this situation, Marcelo you say that running from command prompt manually works - https://github.com/open-rpa/node-red-contrib-tagui/issues/2#issuecomment-852302252

But somehow, running from Node-RED fails with the websocket not open error - https://github.com/open-rpa/node-red-contrib-tagui/issues/2#issuecomment-852303632

I saw a Node-RED discussion thread mentioning SSL and IP address but I'm not familiar with Node-RED enough to understand if that is related to the issue here - https://discourse.nodered.org/t/communication-send-error-error-websocket-is-not-open-readystate-3-closed/22172/14

Another popular open-source tool is also getting this error - https://github.com/cypress-io/cypress/issues/5685

Node-RED Forum
"Communication send error: Error: WebSocket is not open: readyState 3 (CLOSED)
That's why we need to see the startup logs.
marcelocecin commented 3 years ago

node-red runs tagui in which way?

kensoh commented 3 years ago

It looks no difference to me from the source code (just spawning a child process from NodeJS to run TagUI) https://github.com/open-rpa/node-red-contrib-tagui/blob/19f9319740156b10a0cd7e6ecf8ecb2c686ff6f8/src/tagui.ts#L114 but will leave Allan to comment more.

marcelocecin commented 3 years ago

would it be possible to get the value of the taguiexe variable? is it possible to get more complete logs about this run?

skadefro commented 3 years ago

It looks no difference to me from the source code (just spawning a child process from NodeJS to run TagUI)

https://github.com/open-rpa/node-red-contrib-tagui/blob/19f9319740156b10a0cd7e6ecf8ecb2c686ff6f8/src/tagui.ts#L114

but will leave Allan to comment more.

Yes, it simply runs tagui from the install folder in ~

skadefro commented 3 years ago

would it be possible to get the value of the taguiexe variable?

Could add it to the msg object, but what is the use case where you would need that ?

is it possible to get more complete logs about this run?

If you disable the "Quiet" option, you will get all the output from the live session from the second output.

kensoh commented 3 years ago

For taguiexe variable it looks like something very simple, just running tagui command -

https://github.com/open-rpa/node-red-contrib-tagui/blob/19f9319740156b10a0cd7e6ecf8ecb2c686ff6f8/src/tagui.ts#L53

marcelocecin commented 3 years ago

hi Allan, how do I disable the "Quiet" option ? thank you !

skadefro commented 3 years ago

Remove the check mark ? image

kensoh commented 3 years ago

Adding on, TagUI uses port 9222 to connect to Chrome using websocket. But I don't think NodeRED uses this port and the reason for the websocket error message is due to such conflict from NodeRED. Because I can run Node-RED TagUI ok on my macOS. I have previously tried running many times and did not trigger this error message you shared here - https://github.com/open-rpa/node-red-contrib-tagui/issues/2#issuecomment-852303632

--remote-debugging-port=9222
marcelocecin commented 3 years ago

is possible to use https://github.com/tebelorg/RPA-Python instead https://github.com/kelaberetiv/TagUI ?

GitHub
tebelorg/RPA-Python
Python package for doing RPA. Contribute to tebelorg/RPA-Python development by creating an account on GitHub.
GitHub
kelaberetiv/TagUI
Free RPA tool by AI Singapore. Contribute to kelaberetiv/TagUI development by creating an account on GitHub.
skadefro commented 3 years ago

Not for the TagUI node, since it depends on live mode. But there are several ways you can use the RPA python package from NodeRED. The most easy, would be to enable function_external_modules in nodered settings. This allows you to define a list of NPM modules you want access to, on the function node. Here you can then install a package to call python. In my examples I use PythonShell and then using exec nodes you can trigger an install of the RPA pacakge if you don't have it installed already. The above is what i completly automate using my TagUI-NodeRED docker image

( using this guide that uses an image made from this Dockerfile and can be used with these example files. )

marcelocecin commented 3 years ago

ok thanks Allan

marcelocecin commented 3 years ago

Hi guys just an update of an error that happened to me on MAC OS when I installed the plugin through the Palette, the executables in the CASPERJS and PHANTOMJS folders were corrupted later I will test if this also occurs on Ubuntu thanks

kensoh commented 3 years ago

Thanks Marcelo, when I look at the code, it extracts to user home directory. On mac that would be ~ folder.

https://github.com/open-rpa/node-red-contrib-tagui/blob/19f9319740156b10a0cd7e6ecf8ecb2c686ff6f8/src/tagui.ts#L50

If users has an existing installation at ~/tagui folder yes I think this package might have a remote possibility overwrite there.

However, there is already condition check that should have flagged out an existing installation and should not overwrite.

https://github.com/open-rpa/node-red-contrib-tagui/blob/19f9319740156b10a0cd7e6ecf8ecb2c686ff6f8/src/tagui.ts#L55

skadefro commented 3 years ago

As @kensoh points out, if you already have tagui installed in the ~/tagui it will not touch it.