fpv-wtf / wtfos-configurator

Configurator for wtfos, with built in margerine
GNU Affero General Public License v3.0
42 stars 16 forks source link

If package config file is 0kb JSON parsing breaks #330

Open j005u opened 1 year ago

j005u commented 1 year ago

Device

Goggles V2

Trace ID (bototm left)

e7869c5a-e396-4cc7-b84b-4fd233359e77

Describe the issue

I had a user unable to configure moonlight-shim because their config.json was 0 bytes. We manually moved over the -opkg update config file, the GUI worked for a moment, but then config.json somehow became 0 bytes again.

I haven't figured out why this happened and eventually the user was able to get everything working by re-installing wtfos completely, however the sentry issue shows over 500 events from close to 300 users so I'm concerned something is actually broken.

Issue on Sentry: https://fpv-out-club.sentry.io/share/issue/fce16bf8c0f84250b3d3dab71e2a8720/

It would probably be nice if we could handle empty config.json files by just applying defaults to the form, but the real question is why is they config file getting emptied. So far it appears to have been triggered by navigating to the packages config page, but we don't have a clear repro yet.

stylesuxx commented 1 year ago

OK, very interesting. I will have a look at this in the evening. I can definitely put a guard in place to only write the file if content is actually present - at least we can then exclude that as an issue.

Can you tell if this was only happening after saving the settings at least one time, or does the error show from the get go?

stylesuxx commented 1 year ago

OK - so those are actually two separate issues. The linked sentry issue is if package details can not be found and is now safeguarded with #331 and is closer related to #316 and will ultimaely be fixed when I am done with #13.

benlumley commented 1 year ago

Had similar issue with the uiSchema; which I solved like this:

https://github.com/benlumley/wtfos-configurator/commit/850bdcd37d42b888ac602561ee358ca286de71f3#diff-4f84aa7587e5c30c9094c55e7eb6c63c299facaf9fb72dfc7cb8d7575fea4e92R499

If you like that approach; then I think it'd be a good idea to guard accessing the config.json in the same way ?