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

socket.io error connect fair-value.js cannot read property of undefined #35

Closed
amoscatelli1 opened this issue Jul 1, 2017 · 16 comments
Closed

Comments

@amoscatelli1
Copy link

What would be causing this:
13:14:45.664 main Requiring authentication to web client
13:14:45.707 main Listening to admins on port 3000
13:14:45.717 broker Exchange details { exchange: 'OkCoin',
pair: 'BTC/USD',
minTick: 0.01,
minSize: 0.01,
makeFee: 0.001,
takeFee: 0.002,
hasSelfTradePrevention: false }
13:14:45.731 main Unhandled rejection! TypeError: Cannot read property 'value' of undefined
at new FairValueEngine (/opt/finbots/K/Krypto-trading-bot/app/server/fair-value.js:22:67)
at Object. (/opt/finbots/K/Krypto-trading-bot/app/server/main.js:204:22)
at next (native)
at fulfilled (/opt/finbots/K/Krypto-trading-bot/app/server/main.js:4:58)
at process._tickCallback (internal/process/next_tick.js:109:7)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3 Promise {
TypeError: Cannot read property 'value' of undefined
at new FairValueEngine (/opt/finbots/K/Krypto-trading-bot/app/server/fair-value.js:22:67)
at Object. (/opt/finbots/K/Krypto-trading-bot/app/server/main.js:204:22)
at next (native)
at fulfilled (/opt/finbots/K/Krypto-trading-bot/app/server/main.js:4:58)
at process._tickCallback (internal/process/next_tick.js:109:7)
at Module.runMain (module.js:606:11)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3 }
13:14:45.762 main Error THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END IS NEVER THE END
13:14:47.462 okcoin Successfully connected to addChannel: ok_sub_spotusd_btc_depth_20
13:14:47.465 okcoin Successfully connected to addChannel: ok_sub_spotusd_btc_trades
13:14:47.467 okcoin Successfully connected to login
13:14:47.762 main Exit code 0
error: Forever detected script exited with code: 0
error: Script restart attempt #1
13:14:48.996 main Requiring authentication to web client
13:14:49.047 main Listening to admins on port 3000
13:14:49.067 broker Exchange details { exchange: 'OkCoin',

Thank you for your answer.

@Camille92
Copy link
Contributor

same here

@CarlitoGrey
Copy link
Contributor

Same, since the db upgrade, but only on a new build, the upgraded client from mongo works fine. Something returning null because it's the first run?

@Camille92
Copy link
Contributor

@CarlitoGrey so you're saying it works fine on a newly installed K?

@CarlitoGrey
Copy link
Contributor

@Camille92 no the opposite, the existing K I upgraded from mongo to sqlite works. A freshly installed copy of K doesn't.

@wezzix
Copy link

wezzix commented Jul 2, 2017

I'm getting the same stack trace on a fresh install with unmodified config/ENV in docker (Windows).

@Camille92
Copy link
Contributor

I got it running on a clean instal, I had to do a couple of npm install but it works :)

@amoscatelli1
Copy link
Author

Which things did you install Camille92?

@Camille92
Copy link
Contributor

Hi guys so here is what I did:

  1. Redownload K in another location:
    I was /K now I'm /root/K.
    I think you can use the same location but don't hesitate to remove the node module files to have a clean start.

  2. Complete your conf files and others changes you do usually (ie: deleting SSL certs, modifying main.ts with your defaults configs etc...).

  3. Run npm install --unsafe-perm a first time.
    Note: I use --unsafe-perm because I'm root, you don't need it if you're not root.
    At this step, this should be blocked in a loop after a few minute. Do Ctrl + C to cancel the install (but know that half of K is installed already).

The loop looks like that:

../DOMDocument.h:71:16: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
   typedef std::auto_ptr<DOMDocument> DOMDocumentPtr;
                ^
In file included from /usr/include/c++/5/memory:81:0,
                 from ../Utility.h:99,
                 from ../FieldTypes.h:29,
                 from ../SessionState.h:29,
                 from ../Session.h:29,
                 from SessionTestCase.cpp:28:
/usr/include/c++/5/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;
                            ^
In file included from ../MessageStore.h:29:0,
                 from ../SessionState.h:30,
                 from ../Session.h:29,
                 from SessionTestCase.cpp:28:
../Message.h:342:15: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
   static std::auto_ptr<DataDictionary> s_dataDictionary;
               ^
In file included from /usr/include/c++/5/memory:81:0,
                 from ../Utility.h:99,
                 from ../FieldTypes.h:29,
                 from ../SessionState.h:29,
                 from ../Session.h:29,
                 from SessionTestCase.cpp:28:
/usr/include/c++/5/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;

  1. Run npm install --unsafe-perm a SECOND time.
    Installation should be completed this time, if not, repeat 3 and 4 until it is.

I think I had to do it 3 times total, I was blocked the second time by that being ultra long:

> K.js@3.0.0 test-stunnel /root/K
> test -z "$SKIP_STUNNEL$(ps axu | grep stunnel | grep -v grep)" && exec stunnel dist/K-stunnel.conf || :


> uws@8.14.0 install /root/K/node_modules/uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0

You know the installation is complete when you get:

up to date in 44.491s

  1. Run nodejs K.js to see the log (or nodejs K.js YOURCONF.json if you don't use default conf)
    This should get you an error like:
module.js:472
    throw err;
    ^

Error: Cannot find module '/root/K/node_modules**/node-quickfix-wrap**/build/Release/node_quickfix.node'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/root/K/node_modules/node-quickfix-wrap/index.js:1:78)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
  1. Install the missing modules:
    npm install node-quickfix-wrap

Repeat 5) and 6) until there are not missing modules, you have the name of the missing module in the first lines of the error.

  1. When the bot finally starts, run a final npm install just to be sure and you're done.

This is for sure not be the best guide but it's how I got it to work!

I'm on Ubuntu 16.04 with node 7.1

@ctubio
Copy link
Owner

ctubio commented Jul 3, 2017

sorry i wrote shit (related to TypeError: Cannot read property 'value' of undefined) will be fixed next

@ctubio ctubio closed this as completed in 1d3a4cd Jul 3, 2017
ctubio added a commit that referenced this issue Jul 3, 2017
…35.

Free Software Free Society

To support commits by ctubio,
you can buy-me-a-drink with a small git tip at:
  1GitTipgxvKB3zjCLXRcSgDhC9pivkpc7u

I promise to drink chocolate milk in the development of the next commit.

To request new features or in case this commit breaks something for you,
please create a new github issue with all possible details,
but never share your API Keys!

Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>

Free Software Free Society

To support commits by ctubio,
you can buy-me-a-drink with a small git tip at:
  1GitTipgxvKB3zjCLXRcSgDhC9pivkpc7u

I promise to drink chocolate milk in the development of the next commit.

To request new features or in case this commit breaks something for you,
please create a new github issue with all possible details,
but never share your API Keys!

Signed-off-by: Carles Tubio <ctubio@users.noreply.github.com>
@shanehull
Copy link

Is this fixed in current build? I've tried @Camille92's method but can't get past the loop.

@ctubio
Copy link
Owner

ctubio commented Jul 4, 2017

@shed909 the error of TypeError: Cannot read property 'value' of undefined was fixed in the last commit; with git fetch && git merge origin/master && npm install you should get the last version; feel free to paste a log if you are still stucked and want further help

@ctubio
Copy link
Owner

ctubio commented Jul 4, 2017

if you are running the app with user root, is normal that you have so many problems and need so many steps to install; the app is not supposed to be installed or to be run as root. if you need to use --unsafe-perms is because you are installing/running the app from a different user, and obviously it gets complicated.

@shanehull
Copy link

I'l give it a try!

@ctubio
Copy link
Owner

ctubio commented Jul 4, 2017

aaalso you should not install the app in the root folder of the system; that is like placing your bed in the corridor of your house; be safe, place your bed in your bedroom (or in a room with a window and far from the entrance door), and your programs in your home folder (or in a folder under the ownership of a normal user)

@shanehull
Copy link

shanehull commented Jul 4, 2017

Tried installing as a standard user, but I got the following output in a never ending loop:

In file included from ../../../include/quickfix/Application.h:25:0,
                 from Application.h:25,
                 from Application.cpp:26:
../../../include/quickfix/Message.h:342:15: warning: ‘template<class> class std::auto_ptr’ is deprecated [-Wdeprecated-declarations]
   static std::auto_ptr<DataDictionary> s_dataDictionary;
               ^
In file included from /usr/include/c++/5/memory:81:0,
                 from ../../../include/quickfix/Utility.h:99,
                 from ../../../include/quickfix/FieldTypes.h:29,
                 from ../../../include/quickfix/FieldConvertors.h:25,
                 from ../../../include/quickfix/Field.h:32,
                 from ../../../include/quickfix/FieldMap.h:29,
                 from ../../../include/quickfix/Message.h:29,
                 from ../../../include/quickfix/Application.h:25,
                 from Application.h:25,
                 from Application.cpp:26:
/usr/include/c++/5/bits/unique_ptr.h:49:28: note: declared here
   template<typename> class auto_ptr;

@ctubio
Copy link
Owner

ctubio commented Jul 10, 2017

what do you mean never ending loop? this is the compilation process

ctubio pushed a commit that referenced this issue Feb 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants