kadirahq / fast-render

Render you app even before the DDP connection is live. - magic?
MIT License
560 stars 80 forks source link

Another LiveData Error #12

Open nerdmed opened 10 years ago

nerdmed commented 10 years ago

I am getting an error when using fast-renderer the error seems to happen after server restart. I traced the error to the following Exception from Meteor:

Error

Expected not to find a document already present for an add

packeges/mongo-livedata/collection.js - line 127

        } else if (msg.msg === 'added') {
          if (doc) {
            console.log()
            throw new Error("Expected not to find a document already present for an add");
          }
          self._collection.insert(_.extend({_id: mongoId}, msg.fields));

After removing fast renderer it worked as it should. It seems that this error was caused on login. And maybe because of logintokens that where saved locally or something similar.

I was using meteor 0.7.0.1 - please advice me with more information to support you finding the bug.

arunoda commented 10 years ago

This bug was seems to be fixed. see: #9 Are you using the latest FR version?

nerdmed commented 10 years ago

I just pulled the new version and deployed again - error is not resolved:

bildschirmfoto 2014-01-16 um 11 30 05

arunoda commented 10 years ago

Okay. Can you send me some code where I can reproduce this error.

On Thursday, January 16, 2014, Ahmed Hassan notifications@github.com wrote:

I just pulled the new version and deployed again - error is not resolved:

[image: bildschirmfoto 2014-01-16 um 11 30 05]https://f.cloud.github.com/assets/3820220/1929540/58c35906-7e99-11e3-90a7-32e42226b36b.png

— Reply to this email directly or view it on GitHubhttps://github.com/arunoda/meteor-fast-render/issues/12#issuecomment-32457629 .

Arunoda Susiripala

@arunoda http://twitter.com/arunoda http://gplus.to/arunodahttps://github.com/arunoda http://www.linkedin.com/in/arunoda

nerdmed commented 10 years ago

Hey @arunoda i am sorry i tried to clean up the project and remove company code but i could not reproduce the error on a minimum version of the project. Maybe the FastRender log could help you?

The songs collection is fast rendered inside the iron routers waitOn

DDP_SEND: 
Object {msg: "sub", id: "QRFdCwtegh2E7dQmw", name: "Songs", params: Array[1]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
FAKE_SUB_READY: Songs 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "ready", subs: Array[1], frGen: true}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
APPLY_IR_SUB_CORRECTIONS: Songs 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_SEND: 
Object {msg: "sub", id: "HjJpkhPCttiKLECvJ", name: "Songs", params: Array[1]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
FAKE_SUB_READY: Songs 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "ready", subs: Array[1], frGen: true}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
frontpage renderertd 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:24
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:2
XHR finished loading: "http://app.com/sockjs/info?cb=rnfxrrzuka". 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:8
DDP_SEND: 
Object {msg: "connect", version: "pre1", support: Array[1]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_SEND: 
Object {msg: "sub", id: "upwZxYBKms2dGpXxM", name: "meteor.loginServiceConfiguration", params: Array[0]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_SEND: 
Object {msg: "sub", id: "BNHCc5zgMuWTJMsZJ", name: "meteor_autoupdate_clientVersions", params: Array[0]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_SEND: 
Object {msg: "sub", id: "QRFdCwtegh2E7dQmw", name: "Songs", params: Array[1]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
FAKE_SUB_READY: Songs 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "ready", subs: Array[1], frGen: true}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_SEND: 
Object {msg: "sub", id: "HjJpkhPCttiKLECvJ", name: "Songs", params: Array[1]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
FAKE_SUB_READY: Songs 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "ready", subs: Array[1], frGen: true}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "ready", subs: Array[1]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "meteor_autoupdate_clientVersions", id: "2148e7c8a73db4d22f329f808ef6e0d80f6d34de", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "ready", subs: Array[1]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "ready", subs: Array[1]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DELETING_SUBSCRIPTION: Songs QRFdCwtegh2E7dQmw 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
REVERTING_BACK_TO_ORIGINAL_DDP_HANDLING: 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "2FfBSJsrAs9sz42az", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "7bBqeSe8wdcZ9gy6G", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "CD6rRtdbhnT7vcQnF", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "EqDPEkTPYheZ3f24H", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "FTENQLwhronr33667", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "NciJh6fCdDgATQo7c", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "W82Ec5WSoDqZNpBFL", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "YAYb44483f5Q7mgGK", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "YbBCbH3NpoSuLK2hT", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "daJBDwjb5v5KiQQv2", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "hB7KrrwmMBjctd2bf", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "jsmE5ramf2YHnFRJ7", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "mFNsSjj7KNzEuMiQ3", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "sZyxAw4StW9LcRrJk", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "vk3PFZE5Th8HjgDoi", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "added", collection: "songs", id: "wunSNeWXGkBoXw6M4", fields: Object}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
DDP_RECIEVE: 
Object {msg: "ready", subs: Array[1]}
 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22
Uncaught Error: Expected not to find a document already present for an add 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:9
arunoda commented 10 years ago

That's fine. Send the HTML got from view source too.

On Thursday, January 16, 2014, Ahmed Hassan notifications@github.com wrote:

Hey @arunoda https://github.com/arunoda i am sorry i tried to clean up the project and remove company code but i could not reproduce the error on a minimum version of the project. Maybe the FastRender log could help you?

The songs collection is fast rendered inside the iron routers waitOn

DDP_SEND: Object {msg: "sub", id: "QRFdCwtegh2E7dQmw", name: "Songs", params: Array[1]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 FAKE_SUB_READY: Songs 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "ready", subs: Array[1], frGen: true} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 APPLY_IR_SUB_CORRECTIONS: Songs 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_SEND: Object {msg: "sub", id: "HjJpkhPCttiKLECvJ", name: "Songs", params: Array[1]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 FAKE_SUB_READY: Songs 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "ready", subs: Array[1], frGen: true} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 frontpage renderertd 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:24 event.returnValue is deprecated. Please use the standard event.preventDefault() instead. 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:2 XHR finished loading: "http://app.com/sockjs/info?cb=rnfxrrzuka". 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:8 DDP_SEND: Object {msg: "connect", version: "pre1", support: Array[1]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_SEND: Object {msg: "sub", id: "upwZxYBKms2dGpXxM", name: "meteor.loginServiceConfiguration", params: Array[0]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_SEND: Object {msg: "sub", id: "BNHCc5zgMuWTJMsZJ", name: "meteor_autoupdate_clientVersions", params: Array[0]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_SEND: Object {msg: "sub", id: "QRFdCwtegh2E7dQmw", name: "Songs", params: Array[1]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 FAKE_SUB_READY: Songs 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "ready", subs: Array[1], frGen: true} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_SEND: Object {msg: "sub", id: "HjJpkhPCttiKLECvJ", name: "Songs", params: Array[1]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 FAKE_SUB_READY: Songs 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "ready", subs: Array[1], frGen: true} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "ready", subs: Array[1]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "meteor_autoupdate_clientVersions", id: "2148e7c8a73db4d22f329f808ef6e0d80f6d34de", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "ready", subs: Array[1]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "ready", subs: Array[1]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DELETING_SUBSCRIPTION: Songs QRFdCwtegh2E7dQmw 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 REVERTING_BACK_TO_ORIGINAL_DDP_HANDLING: 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "2FfBSJsrAs9sz42az", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "7bBqeSe8wdcZ9gy6G", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "CD6rRtdbhnT7vcQnF", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "EqDPEkTPYheZ3f24H", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "FTENQLwhronr33667", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "NciJh6fCdDgATQo7c", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "W82Ec5WSoDqZNpBFL", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "YAYb44483f5Q7mgGK", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "YbBCbH3NpoSuLK2hT", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "daJBDwjb5v5KiQQv2", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "hB7KrrwmMBjctd2bf", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "jsmE5ramf2YHnFRJ7", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "mFNsSjj7KNzEuMiQ3", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "sZyxAw4StW9LcRrJk", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "vk3PFZE5Th8HjgDoi", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "added", collection: "songs", id: "wunSNeWXGkBoXw6M4", fields: Object} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 DDP_RECIEVE: Object {msg: "ready", subs: Array[1]} 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:22 Uncaught Error: Expected not to find a document already present for an add 8772b1f5f94132f9b0131c12da9ef38166d76b93.js:9

— Reply to this email directly or view it on GitHubhttps://github.com/arunoda/meteor-fast-render/issues/12#issuecomment-32461325 .

Arunoda Susiripala

@arunoda http://twitter.com/arunoda http://gplus.to/arunodahttps://github.com/arunoda http://www.linkedin.com/in/arunoda

arunoda commented 10 years ago

The issue here is because, there are 2 subscriptions made for the Song publication. One is outside IR and one is inside IR. Currently FastRender does not support multiple subscriptions made for the same publication. This is reason for this issue.

BTW: The subscription made inside the IR did not send any data.

Anyway, I can work on a fix.

nerdmed commented 10 years ago

Great thank you for your effort

wizonesolutions commented 10 years ago

Ah, I think this explains some of my issues too. Is this documented clearly? It's definitely something that can come up in cases like mine, where I migrated to Iron Router specifically so I could use FastRender.

arunoda commented 10 years ago

Hey. I got it. I was quite busy these days. You know creating a lot of projects adds a lot go liability. I will try get this fast as possible.

But migrating to IR is not bad choice anyway :D

On Thursday, February 13, 2014, Kevin Kaland notifications@github.com wrote:

Ah, I think this explains some of my issues too. Is this documented clearly? It's definitely something that can come up in cases like mine, where I migrated to Iron Router specifically so I could use FastRender.

— Reply to this email directly or view it on GitHubhttps://github.com/arunoda/meteor-fast-render/issues/12#issuecomment-34982059 .

Arunoda Susiripala

@arunoda http://twitter.com/arunoda http://gplus.to/arunodahttps://github.com/arunoda http://www.linkedin.com/in/arunoda

wizonesolutions commented 10 years ago

Yeah, I am glad I did. It's so cool :)

Thanks for working on the hard stuff and your help today!

ggmacasaet commented 10 years ago

Hi Arunoda,

Was there a fix implemented for this issue? We are also getting this error in FR and this error is currently breaking the spiderable package whenever the site is rendered through phantomjs.

landland commented 10 years ago

I can confirm that I just ran into this as well at login and have to remove fast-render as a temporary workaround. I am using the latest fast-render version.

arunoda commented 10 years ago

What's the meteor version you are using? If I can have a some minimal repo. I could be able to fix it soon.

On Tuesday, May 27, 2014, landland notifications@github.com wrote:

I can confirm that I just ran into this as well at login and have to remove fast-render as a temporary workaround. I am using the latest fast-render version.

— Reply to this email directly or view it on GitHubhttps://github.com/arunoda/meteor-fast-render/issues/12#issuecomment-44297380 .


Arunoda Susiripala

@arunoda http://twitter.com/arunoda http://gplus.to/arunodahttps://github.com/arunoda http://www.linkedin.com/in/arunoda

landland commented 10 years ago

Release 0.8.1.3

Let me see if it can be reproduced with a minimal repo.

arunoda commented 10 years ago

Cool. Thanks.

On Tuesday, May 27, 2014, landland notifications@github.com wrote:

Release 0.8.1.3

Let me see if it can be reproduced with a minimal repo.

— Reply to this email directly or view it on GitHubhttps://github.com/arunoda/meteor-fast-render/issues/12#issuecomment-44297937 .


Arunoda Susiripala

@arunoda http://twitter.com/arunoda http://gplus.to/arunodahttps://github.com/arunoda http://www.linkedin.com/in/arunoda

landland commented 10 years ago

Ok, I was able to reproduce the error message. What I wasn't able to reproduce was the fact that I can't login. I think it has to do with an appcache conflict, but I haven't been able to dig into it further.

Anyway, you can find repo here: https://github.com/landland/fastrenderrepo

Sometimes you see the message right away and sometimes not. If not, just register a user, logout/login and go back to / a bunch of times. That did it for me.

arunoda commented 10 years ago

Okay. Thanks. I'll looking into this.


Arunoda Susiripala

@arunoda http://twitter.com/arunoda http://gplus.to/arunodahttps://github.com/arunoda http://www.linkedin.com/in/arunoda

On Wed, May 28, 2014 at 12:13 AM, landland notifications@github.com wrote:

Ok, I was able to reproduce the error message. What I wasn't able to reproduce was the fact that I can't login. I think it has to do with an appcache conflict, but I haven't been able to dig into it further.

Anyway, you can find repo here: https://github.com/landland/fastrenderrepo

Sometimes you see the message right away and sometimes not. If not, just register a user, logout/login and go back to / a bunch of times. That did it for me.

— Reply to this email directly or view it on GitHubhttps://github.com/arunoda/meteor-fast-render/issues/12#issuecomment-44317926 .

arunoda commented 10 years ago

Okay. I found the issue. This is with the null publications (autopublish, loggedIn user). I'm looking for a fix.

arunoda commented 10 years ago

Can you please use version 0.2.0 and see whether it has this problem or not? If that version work perfectly, I know where the issue is.

landland commented 10 years ago

I still see this issue using 0.2.0 for https://github.com/landland/fastrenderrepo , but in my app the issue has gone away, except server console gives error Publish handler for null sent no ready signal

arunoda commented 10 years ago

Okay. Let me see, what I can do.


Arunoda Susiripala

@arunoda http://twitter.com/arunoda http://gplus.to/arunodahttps://github.com/arunoda http://www.linkedin.com/in/arunoda

On Thu, May 29, 2014 at 9:41 PM, landland notifications@github.com wrote:

I still see this issue using 0.2.0 for https://github.com/landland/fastrenderrepo , but in my app the issue has gone away, except server console gives error Publish handler for null sent no ready signal

— Reply to this email directly or view it on GitHubhttps://github.com/arunoda/meteor-fast-render/issues/12#issuecomment-44550076 .

Diggsey commented 10 years ago

I also get this exact same error: the logout button disappears if the page is loaded while the user is logged in. Regardless of whether the user is logged in, if a page is loaded, the server outputs the error "Publish handler for null sent no ready signal".

edit: Also, I get the "Expected not to find a document already present for an add" errors too.

arunoda commented 10 years ago

Can you please try this branch: https://github.com/arunoda/meteor-fast-render/tree/fix-49

I've made a fix.

arunoda commented 10 years ago

Released a new version: v0.2.6 This should fix the issue.

Diggsey commented 10 years ago

Thanks, this does indeed fix the issue for me.

landland commented 10 years ago

v0.2.6 works for me. thanks Arunoda.

arunoda commented 10 years ago

Awesome.

On Sunday, June 8, 2014, landland notifications@github.com wrote:

v0.2.6 works for me. thanks Arunoda.

— Reply to this email directly or view it on GitHub https://github.com/arunoda/meteor-fast-render/issues/12#issuecomment-45420716 .


Arunoda Susiripala

@arunoda http://twitter.com/arunoda http://gplus.to/arunodahttps://github.com/arunoda http://www.linkedin.com/in/arunoda

pajooh commented 10 years ago

i have the latest fast-render version(0.2.8) installed, i got:

Uncaught Error: Expected not to find a document already present for an add

from my meteor app browser console, i don't even sure that this is related to fast-render, i just found this issue thread!

krstffr commented 10 years ago

I get the same error as pajooh, don't know if it's fastRender related either.

alethes commented 10 years ago

It's definitely related to MongoDB's ObjectId. If you create documents inside Meteor, string ids are created. They play nicely with Fast Render. However, native drivers create the ObjectId, which somehow causes this issue.

Perhaps it can be fixed easily, but for now to prevent this error you should avoid creating documents outside of Meteor without providing the _id field. If you already have such documents, consider backing up your collection and using something like:

c = db.collection, i = 0;
c.find().forEach(function(a){c.remove({_id:a._id});a._id=String(++i);c.insert(a);})

in your MongoDB shell. Set c to the collection you want to "fix". Note this will replace all _id values.

rantav commented 10 years ago

I see this error too. It seems to be related to object IDs, but I'm generating the object IDs in meteor (not externally) and I take their hex string _id = new Mongo.ObjectID().toHexString(). In general this seems to work well, but when using fast-render I see this error in the browser's console for those objects with generated IDs

I don't know if it actually damages the web page (doesn't seem like it does) but anyway having errors in the console isn't nice...

Uncaught Error: Expected not to find a document already present for an add  collection.js:158
self._connection.registerStore.update                collection.js:158
store.(anonymous function)                livedata_connection.js:443
(anonymous function)                livedata_connection.js:1200
_.each._.forEach                 underscore.js:105
(anonymous function)                 livedata_connection.js:1199
_.each._.forEach                 underscore.js:113
_.extend._livedata_data                 livedata_connection.js:1196
Meteor.default_connection._livedata_data                 ddp_update.js:69
onMessage                 livedata_connection.js:249
(anonymous function)                 stream_client_sockjs.js:170
_.each._.forEach                 underscore.js:105
self.socket.onmessage                 stream_client_sockjs.js:169
REventTarget.dispatchEvent                 sockjs-0.3.4.js:87
SockJS._dispatchMessage                 sockjs-0.3.4.js:1072
SockJS._didMessage                 sockjs-0.3.4.js:1130
that.ws.onmessage                 sockjs-0.3.4.js:1277

Versions I use:

$ cat .meteor/versions
accounts-base@1.1.1
accounts-password@1.0.2
accounts-ui-unstyled@1.1.2
accounts-ui@1.1.1
alanning:roles@1.2.13
aldeed:collection2@2.2.0
aldeed:simple-schema@1.0.3
application-configuration@1.0.2
autoupdate@1.1.1
base64@1.0.0
binary-heap@1.0.0
blaze-tools@1.0.0
blaze@2.0.1
boilerplate-generator@1.0.0
callback-hook@1.0.0
check@1.0.1
coffeescript@1.0.3
ctl-helper@1.0.3
ctl@1.0.1
ddp@1.0.9
deps@1.0.4
djedi:sanitize-html@1.3.0
ejson@1.0.3
email@1.0.3
fastclick@1.0.0
follower-livedata@1.0.1
geojson-utils@1.0.0
html-tools@1.0.1
htmljs@1.0.1
http@1.0.6
id-map@1.0.0
iron:core@0.3.4
iron:dynamic-template@0.4.1
iron:layout@0.4.1
iron:router@0.9.3
jquery@1.0.0
json@1.0.0
less@1.0.9
livedata@1.0.10
localstorage@1.0.0
logging@1.0.3
meteor-platform@1.1.1
meteor@1.1.1
meteorhacks:fast-render@1.1.3
minifiers@1.1.0
minimongo@1.0.3
mobile-status-bar@1.0.0
mongo-livedata@1.0.5
mongo@1.0.6
mrt:fancybox@0.5.0
npm-bcrypt@0.7.7
observe-sequence@1.0.2
ordered-dict@1.0.0
random@1.0.0
reactive-dict@1.0.3
reactive-var@1.0.2
reload@1.1.0
retry@1.0.0
reywood:iron-router-ga@0.3.2
routepolicy@1.0.1
service-configuration@1.0.1
session@1.0.2
sha@1.0.0
spacebars-compiler@1.0.2
spacebars@1.0.2
spiderable@1.0.3
srp@1.0.0
standard-app-packages@1.0.2
templating@1.0.7
tracker@1.0.2
ui@1.0.3
underscore@1.0.0
url@1.0.0
webapp-hashing@1.0.0
webapp@1.1.2
arunoda commented 10 years ago

I fixed this with version 2.0 of FR. You can try that with meteor add meteorhacks:fast-render@2.0.0-rc4

rantav commented 10 years ago

OK thanks @arunoda just tested with fast-render@2.0.0-rc4 and it looks good!

arunoda commented 10 years ago

Great.


Arunoda Susiripala

@arunoda http://twitter.com/arunoda http://gplus.to/arunodahttps://github.com/arunoda http://www.linkedin.com/in/arunoda

On Wed, Nov 12, 2014 at 1:57 PM, Ran Tavory notifications@github.com wrote:

OK thanks @arunoda https://github.com/arunoda just tested with fast-render@2.0.0-rc4 and it looks good!

— Reply to this email directly or view it on GitHub https://github.com/meteorhacks/fast-render/issues/12#issuecomment-62684797 .

ericchen0121 commented 9 years ago

Had the same issue with ObjectIds created outside of meteor (imported my documents using MongoImport), and fast-render@2.0.0-rc4 worked for me as well. Thanks!

arunoda commented 9 years ago

Great. I have fixed couple of many bugs and looking to release 2.0 this week. On 2014 නොවැ 24, සඳුදා at පෙ.ව. 8.18 ericchen0121 notifications@github.com wrote:

Had the same issue with ObjectIds created outside of meteor (imported my documents using MongoImport), and fast-render@2.0.0-rc4 worked for me as well. Thanks!

— Reply to this email directly or view it on GitHub https://github.com/meteorhacks/fast-render/issues/12#issuecomment-64147298 .

Anonyfox commented 9 years ago

any updates here? this issue completely prevents me from using fast-render for my app. Why? This is a meteor 1.0.X app with iron-router, spiderable and fast-render (and other stuff): http://newsfisher.io/article/BLbe8Q3o7nDmYg6cH . The page works fine, but ontop of the generated HTML (with ?_escpaedfragment= as parameter) stands the problematic string. The issue gets even more problematic when you click the "facebook share"-button of the AddThis toolbar, the article description is the error code.

This is a running real app, so please drop a note when you viewed this @arunoda, so I can disable fast-render again. Fast-render's version is meteorhacks:fast-render@2.1.6.

EDIT: the issue was the following: I tracked the page impression for a given article in the template's rendered callback. solved it by moving the code to a server method. I'll let this here just in case this comes up again.

arunoda commented 9 years ago

Related issue: #80

IstoraMandiri commented 9 years ago

I'm getting Publish handler for null sent no ready signal on the server whenever a logged-out client refreshes, but my app seems to work fine.

I'm using fast-render as a dependency in a package, which calls FastRender.onAllRoutes.

If user is logged in and refreshes, the error doesn't occur. If use is not logged in I get the above error printed in the server console 4 times each time the client refreshes.

arunoda commented 9 years ago

Actually, you've created a publication(probably null) and it didn't call this.ready() within 500 millis. May be it could be a normal publication as well.

Generally, This happens when a publication takes more than 500 ms to complete.

IstoraMandiri commented 9 years ago

Thanks @arunoda, I found the problem. I do think the warning is a giving false positive though.

Old version, casing warning:

Meteor.publish null, -> if Roles.userIsInRole @userId, ['admin'] then collections.Posts.find()

New version, warning doesn't occur:

Meteor.publish null, -> if Roles.userIsInRole @userId, ['admin'] then collections.Posts.find() else null

I do have some other named publications (not null) that don't explicitly return null, but they don't give the no ready signal warning; they would do if they were named null.

arunoda commented 9 years ago

Actually from a publication you must return a cursor. Otherwise sub is waiting for the this.ready()

So, if there is no cursor, you need to send an empty array or call this.ready()

We check for null as well. But you should not send null. On 2015 පෙබ 6, සිකු at ප.ව. 3.50 Chris Hitchcott notifications@github.com wrote:

Thanks @arunoda https://github.com/arunoda, I found the problem. I do think the warning is a giving false positive though.

Old version, casing warning:

Meteor.publish null, -> if Roles.userIsInRole @userId, ['admin'] then collections.Posts.find()

New version, warning doesn't occur:

Meteor.publish null, -> if Roles.userIsInRole @userId, ['admin'] then collections.Posts.find() else null

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/meteorhacks/fast-render/issues/12#issuecomment-73215773 .

IstoraMandiri commented 9 years ago

Okay, thanks for the info!

adeelraza commented 9 years ago

I recently upgraded to Meteor 1.1 and this issue has started happening again. Is it just me?

jhuenges commented 9 years ago

Same for me!

benlavalley commented 9 years ago

Getting this too with 1.1 - need to start digging into my publications and find out where I'm not properly returning a cursor.

adeelraza commented 9 years ago

I nailed down the problem to a null publication (Meteor.publish(null.....). Adding this.ready() in it fixed it.

benlavalley commented 9 years ago

I found my bad publication as well -- the issue was with how I'm using Andrew Mao aka Mizzao's userstatus plugin. It's been a while since I implemented it, but I had some client and server-side javascript files I created when I laid it down (0.6.4 now).

I changed the publication javascript to publish a dedicated name instead of null and updated one of my client javascript files to subscribe to that publication.

Problem solved, now I'm pushing 1.1 to my production servers.

I was able to narrow it down by turning on mongo profiling and looking at logs.

elie222 commented 9 years ago

Same problem here

elie222 commented 9 years ago

My problem was with the okgrow:analytics package. It had a null publication that wasn't calling this.ready() when there was no user logged in.