-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Inserting multiple items with the same _id into a local collection results in very confusing error #1246
Comments
Seems like both myself and the other user encountered this error using https://github.com/matb33/meteor-collection-hooks. Will confirm, but doesn't seem like a Meteor core bug. |
I've spent several hours trying to track this down. The collection hooks don't appear to be responsible -- in the case of digilord's codebase, the "user-status" smart package was responsible for causing his problems. mizzao, that package looks like it's one of yours. Did you by any chance have that smart package enabled when you got your error? |
Hi @matb33, Yes, I did have that package enabled. Can you send me a message with exactly what seems to be causing that error? That package is pretty simple and I'm not sure what it could be doing that would cause this. |
You are inserting a document into an in-memory collection (UserSessions) and manually specifying the _id. Sometimes that insert gets called multiple times with the same _id. |
I'll test for and fix that bug in my code. However, I still think that
qualifies as a Meteor bug. |
@matb33 thanks for finding this. To reproduce
On the client, this says "insert failed". On the server, it just prints the following. I think both error messages could be enhanced a bit and save some poor fool like me several hours of debugging in the future.
|
@mizzao I agree the error message could be much clearer. When the exception is thrown, it would be very beneficial for the stack trace to show the error message from the Error object. |
Thanks, minimongo errors were using a technique that led to poor stack traces. Fixed on devel. |
Both myself and at least one other user have seen the following very strange bug pop up spontaneously in a Meteor app:
It doesn't tell you what exactly the problem is (why is minimongo on the server anyway?) and I could only get it to go away by randomly changing my code around.
References:
As you can see, it's not related to the fact that I was using Tinytest as another user has also had the same problem during normal Meteor use.
I can try to show code that reproduces this error if that helps, although when I was observing it, it was not deterministic.
EDIT: Title updated after we found out what was going on.
The text was updated successfully, but these errors were encountered: