Using .obj loader in Server

I am running BABYLON.js on a server with node.
I am trying to load an obj file that loads fine in the sandbox, but when I load it using SceneLoader.AppendAsync() the operation completes successfully, but an subsequent call to BABYLON.SceneSerializer.Serialize() causes an exception to be thrown with the message: Cannot read property ‘length’ of undefined
The file loads fine when running from a web browser.
Any suggestions?


hi @Michael_Scherotter - I’ve worked a bit on the obj loader, but never tried from server side. Can you provide a full stack trace?

edit: I also wrote a couple of unit tests that run in node, so suspect it may be more with serialization :slight_smile:

Here is the stack trace:

“TypeError: Cannot read property ‘length’ of undefined\n at t.serialize (D:\Source\Repos\gallery\web\node_modules\babylonjs\babylon.js:16:78281)\n at b_ (D:\Source\Repos\gallery\web\node_modules\babylonjs\babylon.js:16:3108247)\n at Function.e.Serialize (D:\Source\Repos\gallery\web\node_modules\babylonjs\babylon.js:16:3110920)\n at CentralHall. (D:\Source\Repos\gallery\web\server\server\CentralHall.js:82:61)\n at ()\n at fulfilled (D:\Source\Repos\gallery\web\server\server\CentralHall.js:24:58)\n at processTicksAndRejections (internal/process/task_queues.js:93:5)”

Is there any way to have node use the non-minifed source for debugging the callstack?

It looks like you using the non-es6 dep. Is there a babylon.max.js like here:
Babylon.js/dist/preview release at master · BabylonJS/Babylon.js (