metarhia / metarhia/Example

Subscribe / Unsubscribe error

Open
#96 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
211
Forks
82
PR merge metrics
No merged PRs in 30d

Description

Node version: 14.15.3
OS: MacOS 11.2.1

In Example directory:
1) rm -R node_modules
2) git pull
3) npm install

Example version: 1.1.2
```javascript
"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:
```javascript
"name": "metacom",
"version": "1.5.3",
```

1) Write in browser console: `await api.example.subscribe()`
2) Refresh page
3) And in macos console:
```javascript
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:
```javascript
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)

```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the subscription flow in the Example directory, then inspect node_modules/metacom/lib/channel.js at line 75 and application/api/example.1/subscribe.js at line 4, where the reported error originates. Trace why the client connection is undefined after refresh; done means subscribe and unsubscribe no longer produce the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.