Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 [Bug]: 同步物料时未校验JSON,导致无法parse的JSON入库 #13

Open
artifyfun opened this issue Mar 29, 2024 · 3 comments

Comments

@artifyfun
Copy link

Environment

Chrome 版本 122.0.6261.129(正式版本) (64 位)

Version

v16.20.2

Version

@opentiny/[email protected]

Link to minimal reproduction

最新

Step to reproduce

  1. 新增一个组件物料
  2. 执行 pnpm buildMaterials
  3. 提示新增成功,查看数据库已入库

但是刷新页面后,提示服务器500,查看是data-center报了错,有个物料JSON无法parse成功
[2024-03-28T11:17:34.667Z] debug GET /apps/918 (119 ms) 200
[2024-03-28T11:17:34.698Z] error SyntaxError: Expected ',' or '}' after property value in JSON at position 1257
SyntaxError: Expected ',' or '}' after property value in JSON at position 1257
at JSON.parse ()

检查数据库中新增的物料,确实无法parse,删除物料后刷新页面正常进入

建议入库前做个JSON校验

What is expected

No response

What is actually happening

No response

Any additional comments (optional)

No response

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: 🐛 [Bug]: JSON is not verified when synchronizing materials, resulting in JSON that cannot be parsed and stored in the database.

@lu-yg
Copy link
Contributor

lu-yg commented Jul 4, 2024

你通过前端脚本同步物料数据到后端数据库,插入的数据有问题,有json格式的数据,但是你入库的数据并不是json,所以报这个错,检查下数据库里面组件的数据格式

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


You synchronize material data to the back-end database through the front-end script. There is a problem with the inserted data. There is json format data, but the data you put into the database is not json, so this error is reported. Check the data format of the components in the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants