kilianc / kilianc/node-apiserver

account example error on node 0.8.4

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

Description

Trace below. This happens because the domain option is copied to the ApiServer instance. In 0.8.x EventEmitter tries to 'enter' the domain. I changed the name of the domain option to 'domain_compat' and to get it working.

The real fix? Use a sub-object for the EventEmitter instead of inheriting it? Namespace the options? Both inconvenient.

events.js:80
this.domain.enter();
^
TypeError: Object localhost has no method 'enter'
at EventEmitter.emit (events.js:80:19)
at onRequest (.... /node-apiserver/examples/account/node_modules/apiserver/lib/apiserver.js:120:8)
at Server.EventEmitter.emit (events.js:91:17)
at HTTPParser.parser.onIncoming (http.js:1783:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete](http.js:111:23)
at Socket.socket.ondata (http.js:1680:22)
at TCP.onread (net.js:410:27)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the account example on Node 0.8.4 and start at apiserver/lib/apiserver.js:120, using the stack trace to inspect how the domain option reaches EventEmitter. Compare the reported domain_compat workaround with the proposed EventEmitter sub-object or namespaced options; done means the example no longer calls enter on the localhost value.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.