fulcrumapp / fulcrum-desktop

Fulcrum Desktop
http://developer.fulcrumapp.com/desktop/intro/
BSD 3-Clause "New" or "Revised" License
16 stars 4 forks source link

TypeError: Cannot read property 'accountPrefix' of undefined on sync #27

Open geofbaum opened 5 years ago

geofbaum commented 5 years ago

My error is below, this has just happened as I went to sync my local database this morning with Fulcrum. Not sure what is exactly going as it was working last month when I did my sync. I only do a sync once in a while during the winter months because we don't use the app as often. The only thing that has changed since the last sync is the account change due to the price/plan changes. We technically didn't move up or down in terms of features as far as I know so I don't think that should be an issue. The other thing is that we had one large sync (100+ new entries) from one of our devices as one of them was left sitting without syncing to Fulcrum. The reason I bring that up is because as you can see in the code below before the error pops up it is working on the app "Journalier" which is the app that was last synced with the large amount of new entries.

Other than that, the PostgreSQL database hasn't been updated and as I mentioned there were no errors before the account change and the large sync from the one app. Struggling to decide whether or not I should do a clean sync to see if that fixes the issue but I wanted to post here to see if there was suggestion. If anything I will perform a backup of the database before performing the clean sync just in case something happens during the sync that would cause me to lose what is already backedup on the local database. Thanks in advance for any insight or help anyone might be able to provide.

[downloading] forms
[processing] forms
[finished] forms
[downloading] changesets
[processing] changesets
[finished] changesets
[downloading] Journalier
[processing] Journalier
TypeError: Cannot read property 'accountPrefix' of undefined at Function.accountPrefix (C:\Users\geoffrey\AppData\Local\Programs\Fulcrum\resources\app.asar\src\main\models\record-values\record-values.js:437:12) 
at Function.tableNameWithForm (C:\Users\geoffrey\AppData\Local\Programs\Fulcrum\resources\app.asar\src\main\models\record-values\record-values.js:430:39)
at exports.default.rootTableExists.form [as rootTableExists] (C:\Users\geoffrey\.fulcrum\plugins\fulcrum-desktop-postgres\plugin.js:503:57)
at exports.default.<anonymous> (C:\Users\geoffrey\.fulcrum\plugins\fulcrum-desktop-postgres\plugin.js:485:34)
at Generator.next (<anonymous>)
at step (C:\Users\geoffrey\.fulcrum\plugins\fulcrum-desktop-postgres\dist\plugin.js:47:191)
at C:\Users\geoffrey\.fulcrum\plugins\fulcrum-desktop-postgres\dist\plugin.js:47:437
at exports.default.<anonymous> (C:\Users\geoffrey\.fulcrum\plugins\fulcrum-d
esktop-postgres\dist\plugin.js:47:99)
at exports.default.updateRecord (C:\Users\geoffrey\.fulcrum\plugins\fulcrum-
desktop-postgres\plugin.js:26:22)
at C:\Users\geoffrey\.fulcrum\plugins\fulcrum-desktop-postgres\plugin.js:307:16
at Generator.next (<anonymous>)
at step (C:\Users\geoffrey\.fulcrum\plugins\fulcrum-desktop-postgres\dist\pl
ugin.js:47:191)
at C:\Users\geoffrey\.fulcrum\plugins\fulcrum-desktop-postgres\dist\plugin.js:47:437
at C:\Users\geoffrey\.fulcrum\plugins\fulcrum-desktop-postgres\dist\plugin.js:47:99
at onRecordSave (C:\Users\geoffrey\.fulcrum\plugins\fulcrum-desktop-postgres\plugin.js:26:22)
at C:\Users\geoffrey\AppData\Local\Programs\Fulcrum\resources\app.asar\src\main\app.js:128:27
geofbaum commented 5 years ago

After using the --form id option in sync to sync the rest of the apps, I went back to attempt to just do a regular sync which has produced a new error. This time it's saying that there is no such table in my database however I can still access the data from the table in question via pgAdmin, some python code, or javascript code.

[downloading] Journalier
[processing] Journalier
{ Error: no such table: account_1_form_5
    at Database.get lastError [as lastError] (C:\Users\geoffrey\AppData\Local\Pr
ograms\Fulcrum\resources\app.asar\node_modules\minisqlite\dist\index.js:92:24)
    at statement.getResults.results (C:\Users\geoffrey\AppData\Local\Programs\Fu
lcrum\resources\app.asar\node_modules\minisqlite\dist\cursor.js:133:45)
    at Immediate.Statement.setImmediate (C:\Users\geoffrey\AppData\Local\Program
s\Fulcrum\resources\app.asar\node_modules\minisqlite\dist\index.js:171:7)
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5) message: 'no 
such table: account_1_form_5' }

When I attempt to sync with --form 5 it appears to work and responds with a Synced in 0.463 seconds and no apparent updates to the actual form if I check via pgAdmin or another way to see the quantity of rows. Please also see the attached screen shot from pgAdmin.

image

zhm commented 5 years ago

I think you might need to update the postgres plugin. Try running:

fulcrum.cmd update-plugins
geofbaum commented 5 years ago

@zhm Getting errors when I attempt that through the command line. Actually the same error for each of the plugins.

Sorry for the mess in advance, the computer I'm working on's deafult language is French.

C:\Users\geoffrey\AppData\Local\Programs\Fulcrum\scripts>.\fulcrum.cmd update-pl
ugins
fulcrum-desktop-geopackage Pulling changes...
fulcrum-desktop-geopackage Error updating plugin C:/Users/geoffrey/.fulcrum/plug
ins/fulcrum-desktop-geopackage/plugin.js { Error: failed to get server certifica
te: Le handle nÔÇÖest pas dans lÔÇÖ├®tat correct pour lÔÇÖop├®ration demand├®e
 errno: -1 }
fulcrum-desktop-postgres Pulling changes...
fulcrum-desktop-postgres Error updating plugin C:/Users/geoffrey/.fulcrum/plugin
s/fulcrum-desktop-postgres/plugin.js { Error: failed to get server certificate:
Le handle nÔÇÖest pas dans lÔÇÖ├®tat correct pour lÔÇÖop├®ration demand├®e
 errno: -1 }
fulcrum-desktop-reports Pulling changes...
fulcrum-desktop-reports Error updating plugin C:/Users/geoffrey/.fulcrum/plugins
/fulcrum-desktop-reports/plugin.js { Error: failed to get server certificate: Le
 handle nÔÇÖest pas dans lÔÇÖ├®tat correct pour lÔÇÖop├®ration demand├®e
 errno: -1 }
fulcrum-desktop-s3 Pulling changes...
fulcrum-desktop-s3 Error updating plugin C:/Users/geoffrey/.fulcrum/plugins/fulc
rum-desktop-s3/plugin.js { Error: failed to get server certificate: Le handle nÔ
ÇÖest pas dans lÔÇÖ├®tat correct pour lÔÇÖop├®ration demand├®e
 errno: -1 }

Do you think I could just download from the github repo and copy over the update to the folder?

or perhaps fulcrum.cmd update-plugin --url https://github.com/fulcrumapp/fulcrum-desktop-postgres

zhm commented 5 years ago

I think this is an error relating to SSL. What version of Windows is this? You could try replacing the directory, but not being able to download updates might cause future problems. We've seen issues with Windows incompatibilities with modern SSL. Here is some information:

https://support.microsoft.com/en-us/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-wi

geofbaum commented 5 years ago

It's a Win7 Pro computer. Unfortunately I'm at the mercy of our computer supervisor for that one. I'll see what I can do and report back. Thanks for your help Zac.

zhm commented 5 years ago

No problem, good luck!

geofbaum commented 5 years ago

Updated to allow TLS 1.1 and 1.2. Did a restart and retried the plugin update and everything seemed to go smoothly except for an optional dependency that failed a compatibility check.

Moved onto trying to sync, and I am unfortunately not getting anything different still getting the error that states that there is no such table.