Import template from local to mongo db cause error
Hi JsReport team!
Today I come to yo as I'm experiencing an issue regarding import of templates from my local (using standard storage) to a remote server (using docker and mongo for persistence) export/import seems to work correctly at first, but then when I'm trying to access the template I get the following error:
Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
after some reserch I could see that you did encounter something similar in the past,
Also I can no longer edit, delete or generate the imported template. Copy past it's content as a workarround is fine but it can of ruin the purpose of the import/export feature :(
here is the error stack from the console if this can help
Unhandled promise rejection Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters Trace de la pile : Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters at new ObjectID (/usr/src/app/node_modules/bson/lib/bson/objectid.js:34:11) at _convertStringsToObjectIds (/usr/src/app/node_modules/simple-odata-server/lib/mongoAdapter.js:12:14) at _convertStringsToObjectIds (/usr/src/app/node_modules/simple-odata-server/lib/mongoAdapter.js:16:7) at ODataServer.query (/usr/src/app/node_modules/simple-odata-server/lib/mongoAdapter.js:79:3) at /usr/src/app/node_modules/simple-odata-server/lib/odataServer.js:163:14 at /usr/src/app/node_modules/jsreport-mongodb-store/lib/provider.js:36:72 at _fulfilled (/usr/src/app/node_modules/jsreport-mongodb-store/node_modules/listener-collection/node_modules/q/q.js:794:54) at self.promiseDispatch.done (/usr/src/app/node_modules/jsreport-mongodb-store/node_modules/listener-collection/node_modules/q/q.js:823:30) at Promise.promise.promiseDispatch (/usr/src/app/node_modules/jsreport-mongodb-store/node_modules/listener-collection/node_modules/q/q.js:756:13) at /usr/src/app/node_modules/jsreport-mongodb-store/node_modules/listener-collection/node_modules/q/q.js:564:44 at flush (/usr/src/app/node_modules/jsreport-mongodb-store/node_modules/listener-collection/node_modules/q/q.js:110:17) at _combinedTickCallback (internal/process/next_tick.js:73:7) at process._tickCallback (internal/process/next_tick.js:104:9) Y/</t< http://192.168.x.x:5448/studio/assets/client.js:77:19214 G http://192.168.x.x:5448/studio/assets/client.js:77:18611 Y/< http://192.168.x.x:5448/studio/assets/client.js:77:19091 e.exports http://192.168.x.x:5448/studio/assets/client.js:3:9163 <anonyme> http://192.168.x.x:5448/studio/assets/client.js:77:14682 E http://192.168.x.x:5448/studio/assets/client.js:77:14540 A http://192.168.x.x:5448/studio/assets/client.js:77:14560
thanks in advance for your help
[Edit] I did the opposite (export from mongo based studio to local one) and everything work fine, so it's seems to be clearly related to mongodb and its objectId
Thank you for the nice description. We will look into it.
Hi Jan, thanks for the fast reply (as always! ;) )
Let me add that I'm using version
1.8.2on the docker and local (might have been obvious but I prefer to make sure)
also did another test exporting from mongo based then importing it back and it worked like a charm, so it can be narrowed down to non-mongo based toward mongo-based setup
This is now fixed. Please just install the latest
jsreport-expressto your docker image.
It will be part of the next jsreport full release.
Wow thanks a lot!!
Will give you return if I find anything else:)