metarhia/Example

Exception: metasql is undefined

dzxt opened this issue · 4 comments

dzxt commented

Caught an error in application/domain/database/start.js after starting the server, it seems there was no metasql injection
TypeError: Cannot read property 'Database' of undefined Object.<anonymous> (start:5:41)

Please provide full stack trace @dzxt

dzxt commented

Ubuntu 20.04.1 LTS (5.4.0-60-generic)

05:02:21 W3 info Listen port 8002 in worker 3
05:02:21 W1 error Can not load TLS certificates
05:02:21 W2 info Listen port 8001 in worker 2
05:02:21 W1 info Listen port 8000 in worker 1
05:02:21 W5 log Start example plugin
05:02:21 W4 log Start example plugin
05:02:21 W2 log Start example plugin
05:02:21 W3 log Start example plugin
05:02:21 W4 log { set: { key: 'keyName', val: 100 } }
05:02:21 W5 log { set: { key: 'keyName', val: 100 } }
05:02:21 W5 log { get: 'keyName' }
05:02:21 W5 log { return: 100 }
05:02:21 W4 log { get: 'keyName' }
05:02:21 W5 log { res: 100, cache: undefined }
05:02:21 W4 log { return: 100 }
05:02:21 W5 debug Connect to pg
05:02:21 W4 log { res: 100, cache: undefined }
05:02:21 W5 error TypeError: Cannot read property 'Database' of undefined
Object. (start:4:41)
Application.execute (/node_modules/impress/lib/application.js:212:13)
/node_modules/impress/lib/application.js:59:59
Array.map ()
Application.init (/node_modules/impress/lib/application.js:59:42)
async /node_modules/impress/lib/worker.js:55:3
05:02:21 W4 debug Connect to pg
05:02:21 W3 log { set: { key: 'keyName', val: 100 } }
05:02:21 W4 error TypeError: Cannot read property 'Database' of undefined
Object. (start:4:41)
Application.execute (/node_modules/impress/lib/application.js:212:13)
/node_modules/impress/lib/application.js:59:59
Array.map ()
Application.init (/node_modules/impress/lib/application.js:59:42)
async /node_modules/impress/lib/worker.js:55:3
05:02:21 W2 log { set: { key: 'keyName', val: 100 } }
05:02:21 W3 log { get: 'keyName' }
05:02:21 W2 log { get: 'keyName' }
05:02:21 W2 log { return: 100 }
05:02:21 W2 log { res: 100, cache: undefined }
05:02:21 W2 debug Connect to pg
05:02:21 W2 error TypeError: Cannot read property 'Database' of undefined
Object. (start:4:41)
Application.execute (/node_modules/impress/lib/application.js:212:13)
/node_modules/impress/lib/application.js:59:59
Array.map ()
Application.init (/node_modules/impress/lib/application.js:59:42)
async /node_modules/impress/lib/worker.js:55:3
05:02:21 W3 log { return: 100 }
05:02:21 W3 log { res: 100, cache: undefined }
05:02:21 W3 debug Connect to pg
05:02:21 W3 error TypeError: Cannot read property 'Database' of undefined
Object. (start:4:41)
Application.execute (/node_modules/impress/lib/application.js:212:13)
/node_modules/impress/lib/application.js:59:59
Array.map ()
Application.init (/node_modules/impress/lib/application.js:59:42)
async /node_modules/impress/lib/worker.js:55:3
05:02:21 W1 log Start example plugin
05:02:21 W1 log { set: { key: 'keyName', val: 100 } }
05:02:22 W5 debug Connect to metacom
05:02:21 W1 log { get: 'keyName' }
05:02:21 W1 log { return: 100 }
05:02:22 W4 debug Connect to metacom
05:02:21 W1 log { res: 100, cache: undefined }
05:02:21 W1 debug Connect to pg
05:02:22 W1 error TypeError: Cannot read property 'Database' of undefined
Object. (start:4:41)
Application.execute (/node_modules/impress/lib/application.js:212:13)
/node_modules/impress/lib/application.js:59:59
Array.map ()
Application.init (/node_modules/impress/lib/application.js:59:42)
async /node_modules/impress/lib/worker.js:55:3
05:02:22 W3 debug Connect to metacom
05:02:22 W2 debug Connect to metacom
05:02:22 W1 debug Connect to metacom
05:02:22 W2 log 127.0.0.1 anonymous system/introspect
05:02:22 W4 info Application started in worker 4
05:02:22 W3 info Application started in worker 3
05:02:22 W5 info Application started in worker 5
05:02:22 W2 log 127.0.0.1 anonymous system/introspect
05:02:22 W2 log 127.0.0.1 anonymous system/introspect
05:02:22 W2 log 127.0.0.1 anonymous system/introspect
05:02:22 W2 info Application started in worker 2
05:02:22 W2 log 127.0.0.1 anonymous system/introspect
05:02:22 W1 info Application started in worker 1

Have the same problem

Additional information: after system/introspect we have an error too

12:00:35  W2   log     127.0.0.1	anonymous	system/introspect
12:00:35  W2   error   127.0.0.1	GET	/api	403	Forbidden
12:00:35  W2   error   127.0.0.1	GET	/api	500	TypeError: Cannot read property 'select' of null
  Auth.getUser (/node_modules/impress/lib/auth.js:119:8) 
  Object.method (/application/api/auth.1/signIn.js:4:41)
  Channel.rpc (/node_modules/metacom/lib/channel.js:156:33)

I fixed it
Add metasql & pg dependings for fix undefined metasql on startup
And I also suggest correcting the readme. Initialize the database required before starting the application. This is missed in readme