As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
I had my whole offline/syncing strategy working great but sometime here recently it just seemed to break??? :( There's really two major changes that have happened in my phonegap app that might have triggered this issue:
1) Updated Kinvey library to v1.1.5
2) I've been using Telerik's Icenium cloud IDE for over a year now and they just rolled out a new version, made some pretty major overhauls to the product, now known as Telerik AppBuilder
I tried rolling back to v1.1.4(which I think was the last version where Sync actually worked for me)and v1.1.3 just for kicks, and still no luck. Basically I can kick my simulator offline, or take my device offline(put it in airplane mode)successfully do an offline save, then bring the app back online, and the Kinvey.Sync.execute call will fire and complete without error, but no data is being persisted to my dev backend on Kinvey??? I've enabled every possible Cordova plugin available to me in case there was one I was missing that I somehow needed for this to work and that didn't help either.
Just wanted to run this down on the Kinvey side of things to see if you guys had any kind of theory as to what might be happening??
This was EASILY my fave feature of Kinvey, and one I had working really well until recently so I'm pretty bummed at the moment :(
Any help would be greatly appreciated.
oh btw, I do some pretty extensive error logging to my Kinvey backend and nothing is being caught/logged during these sync operations either I'm afraid
I just put out the [1.1.6 release](http://devcenter.kinvey.com/downloads), which contains the fix. Thanks for your feedback and help on resolving this issue!
t
ted shroyer
said
almost 10 years ago
Max-
Thank you. The update to 1.1.5 worked on our app.
When will this fix be added to the phonegap downloads? 1.1.6?
-ted
M
Mark
said
almost 10 years ago
Yes, I am able to reproduce - I submitted a [pull request](https://github.com/tedshroyer/uglyjunk/pull/1) fixing the bug. Can you try and see whether things work correctly now?
t
ted shroyer
said
almost 10 years ago
Hello. I am working with Ryan on this. We have created an example project at this github https://github.com/tedshroyer/uglyjunk
There seems to be a problem of some sort in kinvey-phonegap-1.1.5.js that does not exist in kinvey-phonegap-1.1.4.js.
To see success:
Comment out in index.html .
Comment in in index.html.
To see failure:
Opposite of above (Just run as is)
Is there a new configuration option we are unaware of?
M
Mark
said
almost 10 years ago
Ryan, I’d be happy to help out and investigate what’s exactly going on. As OhmzTech suggested, a snippet to reproduce the problem would be greatly appreciated, as I don’t see anything wrong based on your approach to caching.
R
Ryan Day
said
almost 10 years ago
yeah I think something is just wrong with my environment perhaps...I'm gonna build a small POC with a new AppID this weekend and see if I can get this working at all with a very simple phonegap app. If that doesn't work then I have to suspect something is going on with Telerik's AppBuilder tool
O
OhmzTech
said
almost 10 years ago
Still not seeing any other requests besides the GET? If you aren't then it's not even making it to the server for conflict rejection. Still that's why I mentioned specifically the conflictPolicy when you enable online mode, we've seen this resolve some odd issues before.
At this point it will be hard to provide additional assistance without seeing some code and reproducing the issue in a test case. If you want to set something up (JSFiddle, etc) I would be happy to take a look. Otherwise I think the real Kinvey guys will need to step in and help us out =)
R
Ryan Day
said
almost 10 years ago
That didn't work either :( Basically when I called Kinvey.Sync.online() it just did the same GET request and failed to sync anything new that I saved. It sync'd updates to existing data, but I couldn't write anything new to the backend...is there something I have to do to my collections?? I can't imagine what...almost seems like the conflict resolution policy is not being set properly so the server just ignores the change when a new record is created
O
OhmzTech
said
almost 10 years ago
You should be seeing something besides a GET...
Try this: when you initialize the Kinvey library, in the sync configuration - add an online property and set it to *false*. This means the app will always load in offline mode. Keep in the enabled property the same. Now go through your test case. When you come online again, instead of doing an execute for the sync - if you confirm things are ready just go ahead and call Kinvey.Sync.online({conflict: Kinvey.Sync.clientAlwaysWins}). Pass in any other execute config options necessary. This will put things into online mode and immediately sync any changes.
yep, I guess I never noticed it before lol, but i definitely cannot insert anything new, just updates. I don't understand, my Kinvey.DataStore.save operations are successful when I'm offline so...dunno..here's my typical sync code:
When I init the Kinvey library at startup all I do for sync is pass this --> sync : { enable : true }
I just tried to save a new record while offline, which was successful, then turned around and did a read for all records in the collection I saved to, while still offline, and what I saved is definitely there in the local cache. When I called Sync.execute() after going online then did another read, the collection came back empty from the Kinvey backend >.
what the hell lol??? hmmm...here's the request info I grabbed from Telerik's simulator's console so far
So just to confirm, sounds like the problem is creating new records - updating works fine, correct? I attempted to reproduce, but was unsuccessful. When you do the Sync.execute, after creating the new record locally, I would recommend watching the HTTP requests and seeing what is sent/received. Also, after creating the new record, try fetching again (while still offline) - do all the records return?
What settings do you have for sync when you initialize the Kinvey library? Anything at all?
R
Ryan Day
said
almost 10 years ago
here's a little more detail about my implementation. I manually handle the syncing on my own, i don't follow the automated control workflow outlined in the Kinvey docs. Essentially, anytime I do a CRUD operation against Kinvey backend, I first check the current network connection state using PhoneGap. If I see that I'm offline, then I force offline saving to true at that point (passing offline: true as an option to my save/update call). I also store a flag in localStorage that lets me know "hey at some point you've gone offline and you're going to need to sync data!". My app will just stay offline until one of three things happens:
1) The user performs a CRUD operation, the connection check returns true and the same check also detects the aformentioned flag in localStorage (SyncRequired === true), triggering a Kinvey.Sync.execute() call
2) The user logouts of the app, i.e. logging out of Kinvey. Since they can't logout of Kinvey without being connected, localStorage flag is checked, and if true, Kinvey.Sync.execute() call happens. Upon success/fail return of that operation, a Kinvey.Sync.destruct() call is made (clearing the local cache).
3) User kills the app without logging out. App restarted and upon successful login, localStorage flag is checked. If SyncRequired flag is true, Kinvey.Sync.execute() call is made. Upon return of this call, app refreshes all of its data from the Kinvey backend servers.
That seems like a pretty bulletproof approach (albeit it is quite a bit of code sometimes) and its worked very well up until now.
So anyways, I just did some more testing after you mentioned clearing my backend collections. So here's what I'm noticing right now, if I go offline, edit some existing piece of data, go back online and sync, the changes get pushed to the backend. If I go offline, create a new piece of data to be added, go back online and sync, the change is not pushed to the backend.
So basically I can update stuff offline, but I can't seem to add anything new...any ideas what could be going on here??
O
OhmzTech
said
almost 10 years ago
Hi Ryan - Have you tried clearing local cache? How about clearing your backend collections and starting fresh (assuming you are working with separate development/production environments)? Maybe you are running into conflict issues and it's defaulting to the server version. You said you are updating data - have you tried creating new records while offline and seeing if that syncs?
Make sure when you come back online that you are syncing changes before fetching the server data, or that could be overriding any local changes.
I agree this feature is pretty amazing - 99.9% of the time it just works, plain and simple (that's what makes it so great). However that 0.1% when it doesn't - the problems can be very hard to track down. We've always had the best success by taking a step back and trying to isolate the issue (as I described above).
Ryan Day
1) Updated Kinvey library to v1.1.5
2) I've been using Telerik's Icenium cloud IDE for over a year now and they just rolled out a new version, made some pretty major overhauls to the product, now known as Telerik AppBuilder
I tried rolling back to v1.1.4(which I think was the last version where Sync actually worked for me)and v1.1.3 just for kicks, and still no luck. Basically I can kick my simulator offline, or take my device offline(put it in airplane mode)successfully do an offline save, then bring the app back online, and the Kinvey.Sync.execute call will fire and complete without error, but no data is being persisted to my dev backend on Kinvey??? I've enabled every possible Cordova plugin available to me in case there was one I was missing that I somehow needed for this to work and that didn't help either.
Just wanted to run this down on the Kinvey side of things to see if you guys had any kind of theory as to what might be happening??
This was EASILY my fave feature of Kinvey, and one I had working really well until recently so I'm pretty bummed at the moment :(
Any help would be greatly appreciated.
oh btw, I do some pretty extensive error logging to my Kinvey backend and nothing is being caught/logged during these sync operations either I'm afraid