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

Errors have no stack and apply() is used the wrong way somewhere in ServerResponse #1604

Closed
binarykitchen opened this issue May 4, 2015 · 6 comments

Comments

@binarykitchen
Copy link

I have a very weird iojs v1.8.1 case here and wasted hours to backtrack the cause. Maybe someone can help me here?

In the middleware somewhere an error is thrown and when I do a console.trace(err), I see this output:

[ {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {} ]

console.error(err) outputs this:

TypeError: Function.prototype.apply: Arguments list has wrong type

But nowhere in my code I am doing apply() wrong.

But that's not the problem. The problem is that the stack trace is not working.

When I hack deeper into the native Error class I find this:

ServerResponse.writeHead (_http_server.js:184:44),
ServerResponse._implicitHeader (_http_server.js:151:8),
ServerResponse.OutgoingMessage.end (_http_outgoing.js:538:10),
...

Maybe it's coming from the ServerResponse? That would be the second problem here.

@chrisdickinson
Copy link
Contributor

Hey – it's probably best to take this sort of question to the Node mailing list or StackOverflow. Without a reduced test case (that is, one that minimally reproduces the problem without any other middleware or external packages), it's hard to say whether this is a bug in io.js or not.

I'm closing this issue for now – my advice would be to make sure that nothing in your project (or its dependencies) is stomping on the console.* properties. If you have more questions, I'd be happy to answer them here in the closed thread. If you can provide a reduced test case and it turns out to be a bug in io.js, I'll reopen the issue.

@binarykitchen
Copy link
Author

Ah, I found the cause. It was this "bad" package
https://github.com/mattinsler/longjohn

Removed it from my app. But now, I wonder, how can I obtain long stack traces during development under io.js? @chrisdickinson any clues?

@targos
Copy link
Member

targos commented May 4, 2015

@binarykitchen Have you tried the --stack-trace-limit flag ?
The default value is 10.
More info : https://code.google.com/p/v8-wiki/wiki/JavaScriptStackTraceApi

@binarykitchen
Copy link
Author

@targos well, I doubt raising the stack trace limit will copycat longjohn's behaviour because longjohn also covers async calls

@chrisdickinson
Copy link
Contributor

You might try https://github.com/groundwater/node-stackup – I've heard that it's fairly reliable.

@binarykitchen
Copy link
Author

cool, thx

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

No branches or pull requests

3 participants