strapi-plugin-postgis
strapi-plugin-postgis copied to clipboard
Populate going wrong when Geom is set on
Hi,
Thanks a lot for your awesome plugin which works very well.
I got an issue when i wanna populate an object on my user on which i have added a geom.
So when i wanna do this :
var user = await strapi.entityService.findOne( 'plugin::users-permissions.user', id, { populate: ['music_entities'] } );
I got the following exception - I add the logs in the node_modules.
So when it comes to read 'geom', it's typed as a string field and so a JSON.parse is done on it and so it crashes but i don't know what can be done to fix it, sorry.
[2022-07-28 23:17:11.748] info: Welcome to Strapi Postgis π + π + πΊοΈ | 3.2 USE_GEOS=1 USE_PROJ=1 USE_STATS=1
geom { id: 1, name: 'xxxx', description: 'xxxxx', entity_type: 'band', created_at: 2022-07-26T18:55:31.797Z, updated_at: 2022-07-26T19:23:11.546Z, published_at: 2022-07-26T19:23:11.532Z, created_by_id: 1, updated_by_id: 1, url_encode_name: 'xxxx', location_name: 'xxxxx', socials_url: null, geom: '0101000020E610000047AAEFFCA24356C03FC8B260E22D5040', user_id: 3 } [2022-07-28 23:10:39.079] error: Unexpected number in JSON at position 1 SyntaxError: Unexpected number in JSON at position 1 at JSON.parse (<anonymous>) at JSONField.fromDB (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\database\lib\fields.js:37:48) at fromRow (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\database\lib\query\helpers\transform.js:34:55) at C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\database\lib\query\helpers\transform.js:10:33 at Array.map (<anonymous>) at fromRow (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\database\lib\query\helpers\transform.js:10:16) at fromTargetRow (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\database\lib\query\helpers\populate.js:133:40) at C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\database\lib\query\helpers\populate.js:409:23 at Array.forEach (<anonymous>) at Object.applyPopulate (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\database\lib\query\helpers\populate.js:408:15) at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Object.execute (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\database\lib\query\query-builder.js:357:11) at async Object.findOne (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\database\lib\entity-manager.js:118:22) at async Object.findOne (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\strapi\lib\services\entity-service\index.js:67:20) at async Object.fetch (C:\Projets\Local Stage\local-scene-back-strapi-v4\src\extensions\users-permissions\server\services\user.js:70:16) at async Object.findOne (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\plugin-users-permissions\server\controllers\user.js:152:16) at async returnBodyMiddleware (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\strapi\lib\services\server\compose-endpoint.js:52:18) at async policiesMiddleware (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\strapi\lib\services\server\policy.js:24:5) at async serve (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\koa-static\index.js:59:5) at async returnBodyMiddleware (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\strapi\lib\services\server\compose-endpoint.js:52:18) at async policiesMiddleware (C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\strapi\lib\services\server\policy.js:24:5) at async C:\Projets\Local Stage\local-scene-back-strapi-v4\node_modules\@strapi\strapi\lib\middlewares\body.js:51:9
Is this enough information ?