Preview crashes at load time when including module

The app has no problem running in Local, but since I split my code in different modules, I get a crash at load time on the Android preview

The trace suggests it has to do with require() but I can’t see the issue (again, it works in Local preview).

Preview detected an unhandled exception: Uno.AggregateException: One or more errors occurred.
   at Fuse.UpdateManager.Update(Fuse.Stage)
   at Fuse.UpdateManager.Update()
   at Fuse.AppBase.OnUpdate()
   at Outracks.Simulator.Application.OnUpdate()
   at Fuse.App.FrameCallback.doFrame(long)
ERROR: 
Name: Fuse.Scripting.ScriptException: 
   at Fuse.Scripting.V8.Context.OnScriptException(Fuse.Scripting.V8.Simple.ScriptException)
   at Fuse.Scripting.V8.Simple.DelegateScriptExceptionHandler.Handle(Fuse.Scripting.V8.Simple.ScriptException)
   at Fuse.Scripting.V8.Simple.Function.Call(Fuse.Scripting.V8.Simple.ValueVector)
   at Fuse.Scripting.V8.Function.Call(object[])
   at Fuse.Scripting.ScriptModule.Evaluate(Fuse.Scripting.Context,Fuse.Scripting.Object)
   at Fuse.Scripting.Module.Evaluate(Fuse.Scripting.Context,string)
   at Fuse.Scripting.ScriptModule.RequireContext.Require(string)
   at Fuse.Scripting.ScriptModule.RequireContext.Require(object[])
   at Fuse.Scripting.V8.Marshaller.CallbackWrapper.Call(Fuse.Scripting.V8.Simple.UniqueValueVector)
   at Fuse.Scripting.V8.Simple.DelegateCallback.Call(Fuse.Scripting.V8.Simple.UniqueValueVector)
   at Fuse.Scripting.V8.Simple.Function.Call(Fuse.Scripting.V8.Simple.ValueVector)
   at Fuse.Scripting.V8.Function.Call(object[])
   at Fuse.Scripting.ScriptModule.Evaluate(Fuse.Scripting.Context,Fuse.Scripting.Object)
   at Fuse.Scripting.Module.Evaluate(Fuse.Scripting.Context,string)
   at Fuse.Reactive.JavaScript.EvaluateModule()
   at Fuse.Reactive.JavaScript.EvaluateExports()
   at Fuse.Reactive.JavaScript.EvaluateDataContext()
   at Fuse.Reactive.ThreadWorker.Run()
Error message: Uncaught Fuse.Scripting.ScriptException: 
   at Fuse.Scripting.V8.Context.OnScriptException(Fuse.Scripting.V8.Simple.ScriptException)
   at Fuse.Scripting.V8.Simple.DelegateScriptExceptionHandler.Handle(Fuse.Scripting.V8.Simple.ScriptException)
   at Fuse.Scripting.V8.Simple.Function.Call(Fuse.Scripting.V8.Simple.ValueVector)
   at Fuse.Scripting.V8.Function.Call(object[])
   at Fuse.Scripting.ScriptModule.Evaluate(Fuse.Scripting.Context,Fuse.Scripting.Object)
   at Fuse.Scripting.Module.Evaluate(Fuse.Scripting.Context,string)
   at Fuse.Scripting.ScriptModule.RequireContext.Require(string)
   at Fuse.Scripting.ScriptModule.RequireContext.Require(object[])
   at Fuse.Scripting.V8.Marshaller.CallbackWrapper.Call(Fuse.Scripting.V8.Simple.UniqueValueVector)
   at Fuse.Scripting.V8.Simple.DelegateCallback.Call(Fuse.Scripting.V8.Simple.UniqueValueVector)
   at Fuse.Scripting.V8.Simple.Function.Call(Fuse.Scripting.V8.Simple.ValueVector)
   at Fuse.Scripting.V8.Function.Call(object[])
   at Fuse.Scripting.ScriptModule.Evaluate(Fuse.Scripting.Context,Fuse.Scripting.Object)
   at Fuse.Scripting.Module.Evaluate(Fuse.Scripting.Context,string)
   at Fuse.Reactive.JavaScript.EvaluateModule()
   at Fuse.Reactive.JavaScript.EvaluateExports()
   at Fuse.Reactive.JavaScript.EvaluateDataContext()
   at Fuse.Reactive.ThreadWorker.Run()
File name: /Users/*/Pair/Code/App.js
Line number: 24
Source line: var Login = require('LoginModule');

Can you please zip and upload your project to https://www.dropbox.com/request/ZgndLtJQm5eGzG9cicGK? That would make it easier for us to investigate. Note that projects uploaded to that URL can only be read by the Fuse team.

Hi Anders, it’s sent. It should be hooked to a local server to work properly, but if you can launch the app you’ll be past my issue anyways. I tested it on an iPhone and got a similar problem than with Android: it crashes at load (although I got no crash report screen on iPhone).

Hi again, it turns out that in Store.js, JSON.parse fails because pairs.json is not there.

Of course, Fuse should have given you this error instead of the unhelpful aggregate exception, which is somthing we’ll get fixed asap.

In the future, when you get javascript errors, I recommend trying our JS debugging tools, described in this guide, and this YouTube video.

Thanks so much! I would’ve never found it in a million years… Hope it helped you as well

Yeah, it was nice for us too to be made aware of this problem. Thanks for reporting!