Example
Example copied to clipboard
Subscribe / Unsubscribe error
Node version: 14.15.3 OS: MacOS 11.2.1
In Example directory:
- rm -R node_modules
- git pull
- npm install
Example version: 1.1.2
"devDependencies": {
"@types/node": "^14.14.31",
"eslint": "^7.21.0",
"metatests": "^0.7.2"
},
"dependencies": {
"impress": "^2.0.11",
"metasql": "^0.3.0-alpha.3",
"redis": "^3.0.2"
}
Metacom:
"name": "metacom",
"version": "1.5.3",
- Write in browser console:
await api.example.subscribe()
- Refresh page
- And in macos console:
23:55:42 W2 error TypeError: Cannot read property 'connection' of undefined
Client.emit (/node_modules/metacom/lib/channel.js:75:18)
Timeout._onTimeout (/application/api/example.1/subscribe.js:4:20)
listOnTimeout (internal/timers.js:554:17)
processTimers (internal/timers.js:497:7)
Full console:
00:09:27 W3 info Listen port 7002 in worker 3
00:09:27 W1 info Listen port 7000 in worker 1
00:09:27 W2 info Listen port 7001 in worker 2
00:09:27 W1 debug Start example plugin
00:09:27 W1 debug { set: { key: 'keyName', val: 100 } }
00:09:27 W1 debug { get: 'keyName', return: 100 }
00:09:27 W1 debug { res: 100, cache: undefined }
00:09:27 W1 debug Connect to redis
00:09:27 W1 debug Connect to pg
00:09:27 W1 debug Connect to metacom
00:09:27 W2 log 127.0.0.1 system/introspect
00:09:27 W3 info Application started in worker 3
00:09:27 W2 log 127.0.0.1 system/introspect
00:09:27 W2 log 127.0.0.1 system/introspect
00:09:27 W2 log 127.0.0.1 system/introspect
00:09:27 W4 info Application started in worker 4
00:09:27 W1 info Application started in worker 1
00:09:27 W2 info Application started in worker 2
00:09:27 W2 log 127.0.0.1 system/introspect
00:09:27 W5 info Application started in worker 5
00:09:49 W3 log 127.0.0.1 GET /
00:09:50 W3 log 127.0.0.1 GET /console.css
00:09:50 W3 log 127.0.0.1 GET /console.js
00:09:50 W3 log 127.0.0.1 GET /metarhia.svg
00:09:50 W3 log 127.0.0.1 GET /metacom.js
00:09:50 W3 log 127.0.0.1 GET /events.js
00:09:50 W3 log 127.0.0.1 GET /manifest.json
00:09:50 W3 log 127.0.0.1 system/introspect
00:09:50 W3 debug SELECT data FROM "SystemSession" WHERE token = $1 [jaj1rzAZciWBSVX2bWtwslsulwU2IIib4VLaYwTFtxszi5kdBeodayvNK5y516ad]
00:09:50 W3 log 127.0.0.1 GET /metarhia.png
00:09:50 W3 log 127.0.0.1 auth/restore
00:09:50 W3 log 127.0.0.1 console/content
00:09:52 W3 log 127.0.0.1 GET /worker.js
00:10:02 W3 log 127.0.0.1 example/subscribe
00:10:07 W3 log 127.0.0.1 GET /
00:10:07 W3 log 127.0.0.1 GET /console.css
00:10:07 W3 log 127.0.0.1 GET /console.js
00:10:07 W3 log 127.0.0.1 GET /metarhia.svg
00:10:07 W3 log 127.0.0.1 GET /metacom.js
00:10:07 W3 log 127.0.0.1 GET /events.js
00:10:07 W3 error TypeError: Cannot read property 'connection' of undefined
Client.emit (/node_modules/metacom/lib/channel.js:75:18)
Timeout._onTimeout (/application/api/example.1/subscribe.js:4:20)
listOnTimeout (internal/timers.js:554:17)
processTimers (internal/timers.js:497:7)
00:10:07 W3 log 127.0.0.1 GET /manifest.json
00:10:07 W3 log 127.0.0.1 GET /favicon.ico
00:10:07 W3 log 127.0.0.1 system/introspect
00:10:07 W3 debug SELECT data FROM "SystemSession" WHERE token = $1 [jaj1rzAZciWBSVX2bWtwslsulwU2IIib4VLaYwTFtxszi5kdBeodayvNK5y516ad]
00:10:07 W3 log 127.0.0.1 GET /metarhia.png
00:10:07 W3 log 127.0.0.1 GET /favicon.ico
00:10:07 W3 log 127.0.0.1 auth/restore
00:10:07 W3 log 127.0.0.1 console/content
00:10:08 W3 error TypeError: Cannot read property 'connection' of undefined
Client.emit (/node_modules/metacom/lib/channel.js:75:18)
Timeout._onTimeout (/application/api/example.1/subscribe.js:4:20)
listOnTimeout (internal/timers.js:554:17)
processTimers (internal/timers.js:497:7)
00:10:09 W3 log 127.0.0.1 GET /worker.js
00:10:09 W3 error TypeError: Cannot read property 'connection' of undefined
Client.emit (/node_modules/metacom/lib/channel.js:75:18)
Timeout._onTimeout (/application/api/example.1/subscribe.js:4:20)
listOnTimeout (internal/timers.js:554:17)
processTimers (internal/timers.js:497:7)
00:10:09 W1 info Graceful shutdown in worker 1
00:10:09 W2 info Graceful shutdown in worker 2
00:10:09 W3 info Graceful shutdown in worker 3
00:10:09 W4 info Graceful shutdown in worker 4
00:10:09 W5 info Graceful shutdown in worker 5
00:10:09 W1 debug Stop example plugin
00:10:09 W2 debug Stop example plugin
00:10:09 W3 debug Stop example plugin
00:10:10 W3 error TypeError: Cannot read property 'connection' of undefined
Client.emit (/node_modules/metacom/lib/channel.js:75:18)
Timeout._onTimeout (/application/api/example.1/subscribe.js:4:20)
listOnTimeout (internal/timers.js:554:17)
processTimers (internal/timers.js:497:7)
00:10:11 W3 error TypeError: Cannot read property 'connection' of undefined
Client.emit (/node_modules/metacom/lib/channel.js:75:18)
Timeout._onTimeout (/application/api/example.1/subscribe.js:4:20)
listOnTimeout (internal/timers.js:554:17)
processTimers (internal/timers.js:497:7)
00:10:12 W3 error TypeError: Cannot read property 'connection' of undefined
Client.emit (/node_modules/metacom/lib/channel.js:75:18)
Timeout._onTimeout (/application/api/example.1/subscribe.js:4:20)
listOnTimeout (internal/timers.js:554:17)
processTimers (internal/timers.js:497:7)
00:10:13 W3 error TypeError: Cannot read property 'connection' of undefined
Client.emit (/node_modules/metacom/lib/channel.js:75:18)
Timeout._onTimeout (/application/api/example.1/subscribe.js:4:20)
listOnTimeout (internal/timers.js:554:17)
processTimers (internal/timers.js:497:7)
00:10:14 W3 error TypeError: Cannot read property 'connection' of undefined
Client.emit (/node_modules/metacom/lib/channel.js:75:18)
Timeout._onTimeout (/application/api/example.1/subscribe.js:4:20)
listOnTimeout (internal/timers.js:554:17)
processTimers (internal/timers.js:497:7)
I found the reason. There is an error when the token is not used.