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

fix TypeError: Object.keys called on non-object #180

Closed
wants to merge 1 commit into from
Closed

fix TypeError: Object.keys called on non-object #180

wants to merge 1 commit into from

Conversation

willin
Copy link

@willin willin commented Oct 23, 2014

Bug fixed under Restify (almost the same with express.js)

Error 1:

TypeError: Object.keys called on non-object
    at Function.keys (native)
    at Object.parseParameters (/home/open-api/node_modules/newrelic/lib/util/urltils.js:77:14)
    at TraceSegment.markAsWeb (/home/open-api/node_modules/newrelic/lib/transaction/trace/segment.js:91:32)
    at ServerResponse.instrumentedFinish (/home/open-api/node_modules/newrelic/lib/instrumentation/core/http.js:126:15)
    at ServerResponse.g (events.js:199:16)
    at ServerResponse.<anonymous> (/home/open-api/node_modules/newrelic/node_modules/continuation-local-storage/context.js:74:17)
    at ServerResponse.emit (events.js:104:17)
    at ServerResponse.emitted [as emit] (/home/open-api/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/emitter-listener/listener.js:122:21)
    at finish (_http_outgoing.js:517:10)
    at /home/open-api/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31js-bson: Failed to load c++ bson extension, using pure JS version

Error 2:

Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:331:11)
    at ServerResponse.format (/home/open-api/node_modules/restify/lib/response.js:95:10)
    at ServerResponse.send (/home/open-api/node_modules/restify/lib/response.js:205:24)
    at Server.<anonymous> (/home/open-api/app.js:99:8)
    at Server.emit (events.js:129:20)
    at Domain.onError (/home/open-api/node_modules/restify/lib/server.js:775:18)
    at Domain.emit (events.js:107:17)
    at Domain.errorHandler [as _errorHandler] (domain.js:102:19)
    at process._fatalException (node.js:234:33)
    at process._asyncFatalException [as _fatalException] (/home/open-api/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:211:34).write(string, encoding, offset, length) is deprecated. Use write(string[, offset[, length]][, encoding]) instead.

@wraithan
Copy link
Contributor

@willin Can you give reproduction cases for this? Our tests aren't failing. I can adapt the repro into a test to prove there is a problem before I merge this as I can't repro it locally.

@willin
Copy link
Author

willin commented Oct 25, 2014

I have no idea about it.
Our applications could not trace the error.

server.use(restify.acceptParser(server.acceptable));
    server.use(restify.dateParser());
    server.use(restify.queryParser());
    server.use(restify.jsonp());
    server.use(restify.gzipResponse());
    server.use(restify.bodyParser({
        mapParams: false
    }));
    server.get(/^\/((.*)(\.)(.+))*$/, restify.serveStatic({ directory: 'public', default: "index.html" }));

When Error1 occurred, the application will auto restart, during this period, the Error2 may happen.

Why check the parsed.search value but to operate the parsed.query?

@derEremit
Copy link

stumbled upon this or similar bug when switching node binaries if that helps.
exact same codebase
with node 0.10.30 no problem
with node 0.11.14

urltils.js:77
      Object.keys(parsed.query).forEach(function cb_forEach(key) {
             ^
TypeError: Object.keys called on non-object
    at Function.keys (native)
    at Object.parseParameters (/home/zen/projects/cmd/api/node_modules/newrelic/lib/util/urltils.js:77:14)
    at TraceSegment.markAsWeb (/home/zen/projects/cmd/api/node_modules/newrelic/lib/transaction/trace/segment.js:91:32)
    at ServerResponse.instrumentedFinish (/home/zen/projects/cmd/api/node_modules/newrelic/lib/instrumentation/core/http.js:96:15)
    at ServerResponse.g (events.js:199:16)
    at ServerResponse.<anonymous> (/home/zen/projects/cmd/api/node_modules/newrelic/node_modules/continuation-local-storage/context.js:74:17)
    at ServerResponse.emit (events.js:104:17)
    at ServerResponse.emitted [as emit] (/home/zen/projects/cmd/api/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/emitter-listener/listener.js:122:21)
    at finish (_http_outgoing.js:517:10)
    at /home/zen/projects/cmd/api/node_modules/newrelic/node_modules/continuation-local-storage/node_modules/async-listener/glue.js:188:31

@wraithan
Copy link
Contributor

Prerelease versions of node are not supported. Only full release versions of 0.8 and higher are supported. That said, I'm all for trying to make our support of 0.11.x work better so we have less to do when 0.12 comes out. I've been waiting on 0.11.15 (which has a major bump to v8 versions) in it before I started testing heavily on 0.11.x.

I know that we accepted a patch a week or to back that fixed on 0.11 bug in the area you are seeing problems. So make sure you're on the latest version of the agent. I'm accepted the last one because it was a very simple change and tests were 100% fine, but it appears we either didn't fix the whole problem or something else is up. In which case we need to expand our tests to be more robust and actually expose this 0.11 only bug.

@hayes
Copy link
Contributor

hayes commented Mar 20, 2015

Closing this, we have made a lot of improvements since 0.12 was released, have not been able to reproduce this issue

@hayes hayes closed this Mar 20, 2015
jsumners-nr pushed a commit to jsumners-nr/node-newrelic that referenced this pull request Apr 16, 2024
bizob2828 added a commit to bizob2828/node-newrelic that referenced this pull request Apr 19, 2024
…/xml2js-0.5.0

Bump xml2js from 0.4.19 to 0.5.0
bizob2828 added a commit to bizob2828/node-newrelic that referenced this pull request Apr 23, 2024
…/xml2js-0.5.0

Bump xml2js from 0.4.19 to 0.5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants