datocms / gatsby-source-datocms

Official GatsbyJS source plugin to pull content from DatoCMS
MIT License
140 stars 51 forks source link

JSON Unexpected token when a character return in is a json field #94

Closed KyloJorgensen closed 4 years ago

KyloJorgensen commented 4 years ago

1:05:20 AM: error #11321 PLUGIN Unexpected token 1:05:20 AM: in JSON at position 456 1:05:20 AM: "gatsby-source-datocms" threw an error while running the sourceNodes lifecycle: 1:05:20 AM: Unexpected token 1:05:20 AM: in JSON at position 456 1:05:20 AM: See our docs page for more info on this error: https://gatsby.dev/issue-how-to 1:05:20 AM: 1:05:20 AM: SyntaxError: Unexpected token 1:05:20 AM: in JSON at position 456 1:05:20 AM:
1:05:20 AM: - JSON.parse 1:05:20 AM:
1:05:20 AM: - addField.js:77 addField 1:05:20 AM: [repo]/[gatsby-source-datocms]/hooks/sourceNodes/createNodeFromEntity/item/a ddField.js:77:28 1:05:20 AM:
1:05:20 AM: - index.js:42 1:05:20 AM: [repo]/[gatsby-source-datocms]/hooks/sourceNodes/createNodeFromEntity/item/i ndex.js:42:9 1:05:20 AM:
1:05:20 AM: - Array.forEach 1:05:20 AM:
1:05:20 AM: - index.js:41 1:05:20 AM: [repo]/[gatsby-source-datocms]/hooks/sourceNodes/createNodeFromEntity/item/i ndex.js:41:30 1:05:20 AM:
1:05:20 AM: - buildNode.js:13 module.exports 1:05:20 AM: [repo]/[gatsby-source-datocms]/hooks/sourceNodes/createNodeFromEntity/utils/ buildNode.js:13:3 1:05:20 AM:
1:05:20 AM: - index.js:37 1:05:20 AM: [repo]/[gatsby-source-datocms]/hooks/sourceNodes/createNodeFromEntity/item/i ndex.js:37:20 1:05:20 AM:
1:05:20 AM: - Array.map 1:05:20 AM:
1:05:20 AM: - index.js:33 Object.buildItemNode [as item] 1:05:20 AM: [repo]/[gatsby-source-datocms]/hooks/sourceNodes/createNodeFromEntity/item/i ndex.js:33:81 1:05:20 AM:
1:05:20 AM: - index.js:23 module.exports 1:05:20 AM: [repo]/[gatsby-source-datocms]/hooks/sourceNodes/createNodeFromEntity/index. js:23:37 1:05:20 AM:
1:05:20 AM: - index.js:52 1:05:20 AM: [repo]/[gatsby-source-datocms]/hooks/sourceNodes/index.js:52:15 1:05:20 AM:
1:05:20 AM: - Array.forEach 1:05:20 AM:
1:05:20 AM: - EntitiesRepo.js:100 1:05:20 AM: [repo]/[datocms-client]/lib/local/EntitiesRepo.js:100:25 1:05:20 AM:
1:05:20 AM: - Array.forEach 1:05:20 AM:
1:05:20 AM: - EntitiesRepo.js:99 EntitiesRepo.upsertEntities 1:05:20 AM: [repo]/[datocms-client]/lib/local/EntitiesRepo.js:99:28 1:05:20 AM:
1:05:20 AM: - Loader.js:78 1:05:20 AM: [repo]/[datocms-client]/lib/local/Loader.js:78:28 1:05:20 AM:
1:05:20 AM:

KyloJorgensen commented 4 years ago
{
   "foo": "bar
     more stuff"
}

This is an example that breaks it.

matjack1 commented 4 years ago

Yes, you are right, I can reproduce that. Thank you for reporting it!

matjack1 commented 4 years ago

Hello, we have fixed this.

I'm closing this, but if you encounter any other similar error, please comment.