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

Cannot call method "indexOf" of undefined on any DB error #1179

Closed
malagappan opened this issue Aug 13, 2015 · 4 comments
Closed

Cannot call method "indexOf" of undefined on any DB error #1179

malagappan opened this issue Aug 13, 2015 · 4 comments
Assignees
Labels

Comments

@malagappan
Copy link

Getting the error "Cannot call method "indexOf" of undefined" for any error. It apparently fails to execute err.stack.indexOf where err.stack is not set.

"Cannot call method "indexOf" of undefined": TypeError: Cannot call method "indexOf" of undefined at /node_modules/rds/node_modules/mysql/lib/protocol/sequences/Sequence.js:63 at /node_modules/rds/node_modules/mysql/lib/protocol/sequences/Sequence.js:78 at /node_modules/rds/node_modules/mysql/lib/protocol/sequences/Query.js:94 at /node_modules/rds/node_modules/mysql/lib/protocol/Protocol.js:274 at /node_modules/rds/node_modules/mysql/lib/protocol/Parser.js:77 at /node_modules/rds/node_modules/mysql/lib/protocol/Protocol.js:39 at write (_stream_readable.js:601) at flow (_stream_readable.js:610) at pipeOnReadable (_stream_r

When I printed the error packet:

{"fieldCount":255,"errno":1062,"sqlStateMarker":"#","sqlState":"23000","message":"Duplicate entry 'xxxxxx' for key 'xxxxxx'"} 
@dougwilson
Copy link
Member

Hi! Unfortunately I don't seem to be able to reproduce. Is there a way you could put together a very simple file that, when I run it, produces the error above?

@malagappan
Copy link
Author

Hi,

The issue seems to be because of different Javascript engine being used.
We are using rhino and that apparently does not seem to add 'stack' when you do 'new Error()'. It seems it is v8's feature. So in Sequence.js, in _addLongStackTrace() it fails on the following line, because err.stack is undefined:

if (err.stack.indexOf(delimiter) > -1) {
  return;
}

Would it be possible to add a check whether err.stack exists?

Thanks & Regards,
Muthu

@dougwilson
Copy link
Member

Ah, I see. This library has various issues with Rhino in general, and only fully functions in Node.js (v8). Adding this would get you past this issue, but not others. Can you run our entire test suite in Rhino and validate what does and doesn't work before we make any effort to support Rhino?

@dougwilson
Copy link
Member

Here is a link to the issue in Rhino regarding new Error().stack, if it helps as well: mozilla/rhino#153

@dougwilson dougwilson self-assigned this Nov 30, 2015
@dougwilson dougwilson added the bug label Nov 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants