whalesong icon indicating copy to clipboard operation
whalesong copied to clipboard

problems using the library: webpackJsonp is not a function

Open dafner opened this issue 4 years ago • 14 comments

I encountered an error when restarting an application that was normally running I try to run the example 'minibot.py' and the error obtained is the same Ctually, it is impossible to use the library due to the error that occurs: TypeError: webpackJsonp is not a function

Has anyone else had this type of error? have they been able to solve it?

thank you very much for any kind of help you can give me

python3 minibot.py Traceback (most recent call last): File "minibot.py", line 238, in bot.loop.run_until_complete(bot.start()) File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete return future.result() File "minibot.py", line 225, in start await self._driver.start() File "/home/administrador/workspace/whatsappx/whalesong/whalesong/init.py", line 96, in start await self._driver.connect() File "/home/administrador/workspace/whatsappx/whalesong/whalesong/driver_firefox.py", line 108, in connect await self.run_scriptlet() File "/home/administrador/workspace/whatsappx/whalesong/whalesong/driver.py", line 69, in run_scriptlet await self._internal_run_scriptlet(script.read()) File "/home/administrador/workspace/whatsappx/whalesong/whalesong/driver_firefox.py", line 119, in _internal_run_scriptlet await self._run_async(self.driver.execute_script, script) File "/home/administrador/workspace/whatsappx/whalesong/whalesong/driver_firefox.py", line 73, in _run_async return await self.loop.run_in_executor(self._pool_executor, partial(method, *args, **kwargs)) File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 636, in execute_script 'args': converted_args})['value'] File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.JavascriptException: Message: TypeError: webpackJsonp is not a function

dafner avatar Mar 31 '20 23:03 dafner

change wapi.js

//webpackJsonp([], {'parasite': (x, y, z) => getStore(z)}, ['parasite']); 

if (typeof webpackJsonp === 'function') {
    webpackJsonp([], {'parasite': (x, y, z) => getStore(z)}, ['parasite']);
} else {
    webpackJsonp.push([
        ['parasite'],
        {
            parasite: function (o, e, t) {
                getStore(t);
            }
        },
        [['parasite']]
    ]);
}

marcelocecin avatar Apr 01 '20 12:04 marcelocecin

As this project doesn't have wapi.js you may need to edit it here. https://github.com/alfred82santa/whalesong/blob/master/js/src/whalesong/index.js#L319

and build the source again.

vasani-arpit avatar Apr 01 '20 12:04 vasani-arpit

thanks!

I put the following code in the file js/src/whalesong/index.js and then ran the command make build-js

/* webpackJsonp([], { 'whalesong': (x, y, z) => discoveryModules(z) }, ['whalesong']); */

if (typeof webpackJsonp === 'function') { webpackJsonp([], {'whalesong': (x, y, z) => discoveryModules(z)}, ['whalesong']); } else { webpackJsonp.push([ ['whalesong'], { whalesong: function (o, e, t) { discoveryModules(t); } }, [['whalesong']] ]); }

After the whalesong.js file was generated correctly and applying the recommendation indicated by vasani-arpit from Sep 30, 2019 in comment # 121 (https://github.com/alfred82santa/whalesong/issues/121#issuecomment-536587381 ), since there is no correction so far in the library; I ran the minibot.js example again, to verify the correct operation of the library and I got the following error:

$ python3 minibot.py Monitor stream Stream value: Stream.CONNECTED Monitor new messages [email protected] Task exception was never retrieved future: <Task finished coro=<Minibot.make_echo() done, defined at minibot.py:89> exception=ManagerNotFound('Manager chats not found',)> Traceback (most recent call last): File "minibot.py", line 94, in make_echo message.id))) whalesong.errors.ManagerNotFound: Manager chats not found

Has anyone had this same error when using the library and has fixed it?

By the way, is there any other more correct method to solve the problem indicated in # 121 (ManagerNotFound: Manager messages not found) without having to try different values to adjust the delay?

I will appreciate any help you can give me to have the application operational again using this library.

Thanks in advance

dafner avatar Apr 01 '20 14:04 dafner

try to use this https://github.com/mukulhase/WebWhatsapp-Wrapper

marcelocecin avatar Apr 01 '20 18:04 marcelocecin

thanks for your answer marcelocecin, but it is the only option that I have?

By your suggest, I considerer that this proyect is dead

It is very dificult to migrate an async application to a sync, but if it is not more updates here I will need to considerer migrate my application

thanks

dafner avatar Apr 02 '20 00:04 dafner

this one is async https://github.com/smashah/sulla

marcelocecin avatar Apr 02 '20 13:04 marcelocecin

change wapi.js

//webpackJsonp([], {'parasite': (x, y, z) => getStore(z)}, ['parasite']); 

if (typeof webpackJsonp === 'function') {
    webpackJsonp([], {'parasite': (x, y, z) => getStore(z)}, ['parasite']);
} else {
    webpackJsonp.push([
        ['parasite'],
        {
            parasite: function (o, e, t) {
                getStore(t);
            }
        },
        [['parasite']]
    ]);
}

Hi Marcelo, after change wapi.js, get this error

selenium.common.exceptions.JavascriptException: Message: Cyclic object value

can you help me ?

hbustos avatar Apr 08 '20 19:04 hbustos

https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/404

marcelocecin avatar Apr 08 '20 20:04 marcelocecin

thanks, whit firefox 61.02 can't scan QR, web whatsapp page is not displayed properly!

whit Chrome, get this error. selenium.common.exceptions.JavascriptException: Message: javascript error: circular reference

Windows 10. Firefox 61.0.2 Geckodriver 0.26.0 webwhassapi 2.0.3 install from git. selenium 3.141.0

hbustos avatar Apr 08 '20 20:04 hbustos

try to edit wapi.js again

marcelocecin avatar Apr 09 '20 01:04 marcelocecin

Same problem, wich is the best configuration?

OS? firefox version? geckodriver?

any one have this working ?

thanks!

hbustos avatar Apr 09 '20 03:04 hbustos

are you using whalesong or WebWhatsapp-Wrapper ?

marcelocecin avatar Apr 09 '20 10:04 marcelocecin

WebWhatsapp-Wrapper

hbustos avatar Apr 09 '20 14:04 hbustos

please open an issue in the WebWhatsapp-Wrapper repository, if possible include error print

marcelocecin avatar Apr 12 '20 20:04 marcelocecin