When transforming my html to ast, when I upsert my data to Hygraph, I get the error:
[
{ type: 'paragraph', children: [ [Object] ] },
{ type: 'paragraph', children: [ [Object], [Object] ] },
{
type: 'paragraph',
children: [ [Object], [Object], [Object], [Object], [Object] ]
},
{ type: 'paragraph', children: [ [Object], [Object] ] },
{ type: 'paragraph', children: [ [Object], [Object] ] },
{
type: 'paragraph',
children: [ [Object], [Object], [Object], [Object] ]
},
{ type: 'paragraph', children: [ [Object], [Object] ] },
{ type: 'paragraph', children: [ [Object] ] },
{ type: 'paragraph', children: [ [Object] ] },
{ type: 'paragraph', children: [ [Object], [Object] ] },
{
type: 'paragraph',
children: [ [Object], [Object], [Object], [Object] ]
},
{ type: 'paragraph', children: [ [Object] ] }
]
This is my code. I use text_html: ${{ children: data.text_html }}
to insert the ast object.
ClientError: expected RichText raw value to be object: {"response":{"errors":[{"message":"expected RichText raw value to be object"}],"data":null,"extensions":{"requestId":"clrzz9gimewxb0bldfpixb6ki"},"status":400,"headers":{}},"request":{"query":"mutation MyMutation {\n upsertAnnouncement(\n where: { hylexid: \"581215\" }\n upsert: {\n create: { \n hylexid: \"581215\"\n title: \"Word Script Sign—The Alphabet of Art\"\n service: \"eflux\"\n text_html: [object Object]\n image: \"\"\"{\n \"thumb\": {\n \"src\": \"https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,400x400,c\",\n \"width\": 400,\n \"height\": 400\n },\n \"medium\": {\n \"src\": \"https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,680\",\n \"width\": 680,\n \"height\": 906\n },\n \"large\": {\n \"src\": \"https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,1024\",\n \"width\": 1024,\n \"height\": 1365\n },\n \"original\": {\n \"src\": \"https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg?original\",\n \"width\": 3456,\n \"height\": 4608\n }\n}\"\"\"\n slug: \"word-script-sign-the-alphabet-of-art\"\n date: \"2024-01-30\"\n }\n update: {\n title: \"Word Script Sign—The Alphabet of Art\"\n service: \"eflux\"\n text_html: [object Object]\n image: \"\"\"{\n \"thumb\": {\n \"src\": \"https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,400x400,c\",\n \"width\": 400,\n \"height\": 400\n },\n \"medium\": {\n \"src\": \"https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,680\",\n \"width\": 680,\n \"height\": 906\n },\n \"large\": {\n \"src\": \"https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,1024\",\n \"width\": 1024,\n \"height\": 1365\n },\n \"original\": {\n \"src\": \"https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg?original\",\n \"width\": 3456,\n \"height\": 4608\n }\n}\"\"\"\n slug: \"word-script-sign-the-alphabet-of-art\"\n date: \"2024-01-30\"\n }\n }\n ) {\n id\n }\n }"}}
at makeRequest (/Users/arminunruh/Documents/git/eflux-hygraph-migration/node_modules/graphql-request/build/cjs/index.js:310:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
response: {
errors: [ { message: 'expected RichText raw value to be object' } ],
data: null,
extensions: { requestId: 'clrzz9gimewxb0bldfpixb6ki' },
status: 400,
headers: Headers {
[Symbol(map)]: [Object: null prototype] {
date: [ 'Tue, 30 Jan 2024 06:28:33 GMT' ],
'content-type': [ 'application/json' ],
'content-length': [ '134' ],
connection: [ 'keep-alive' ],
'cf-ray': [ '84d7a7ca7e37727c-HAM' ],
'cf-cache-status': [ 'DYNAMIC' ],
'cache-control': [ 'private, no-store' ],
vary: [ 'Origin, Accept-Encoding' ],
'x-cdn-cache-status': [
'optimize,skip-no-query-op,disable-cdn-not-cacheable,disable-cdn,no-transform-is-mutation,fetch-origin,reject-not-ok,update-project'
],
'x-request-id': [ 'clrzz9gimewxb0bldfpixb6ki' ],
'report-to': [
'{"endpoints":[{"url":"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=zvTpVM0sOeWEqBHNoy8fJSTbyvhyDhqftWa%2BvJ6lALJNWKeC%2BelelG34c6sX5fLvF6wqdQmtzhE%2FJP2c0t7rykvTmLHuoDSt9CIIrYsZGTj7PI2qUfxbzl8W9FLg439VTwmW2I7Xp0xwEfyRHHWtj7YHlsscoJW8b1saGTg0uuw090F3J8hB"}],"group":"cf-nel","max_age":604800}'
],
nel: [
'{"success_fraction":0,"report_to":"cf-nel","max_age":604800}'
],
server: [ 'cloudflare' ]
}
}
},
request: {
query: 'mutation MyMutation {\n' +
' upsertAnnouncement(\n' +
' where: { hylexid: "581215" }\n' +
' upsert: {\n' +
' create: { \n' +
' hylexid: "581215"\n' +
' title: "Word Script Sign—The Alphabet of Art"\n' +
' service: "eflux"\n' +
' text_html: [object Object]\n' +
' image: """{\n' +
' "thumb": {\n' +
' "src": "https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,400x400,c",\n' +
' "width": 400,\n' +
' "height": 400\n' +
' },\n' +
' "medium": {\n' +
' "src": "https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,680",\n' +
' "width": 680,\n' +
' "height": 906\n' +
' },\n' +
' "large": {\n' +
' "src": "https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,1024",\n' +
' "width": 1024,\n' +
' "height": 1365\n' +
' },\n' +
' "original": {\n' +
' "src": "https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg?original",\n' +
' "width": 3456,\n' +
' "height": 4608\n' +
' }\n' +
'}"""\n' +
' slug: "word-script-sign-the-alphabet-of-art"\n' +
' date: "2024-01-30"\n' +
' }\n' +
' update: {\n' +
' title: "Word Script Sign—The Alphabet of Art"\n' +
' service: "eflux"\n' +
' text_html: [object Object]\n' +
' image: """{\n' +
' "thumb": {\n' +
' "src": "https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,400x400,c",\n' +
' "width": 400,\n' +
' "height": 400\n' +
' },\n' +
' "medium": {\n' +
' "src": "https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,680",\n' +
' "width": 680,\n' +
' "height": 906\n' +
' },\n' +
' "large": {\n' +
' "src": "https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg,1024",\n' +
' "width": 1024,\n' +
' "height": 1365\n' +
' },\n' +
' "original": {\n' +
' "src": "https://images.e-flux-systems.com/581215_0e60b22986a89d2e23433b61e8d1a6bc.jpg?original",\n' +
' "width": 3456,\n' +
' "height": 4608\n' +
' }\n' +
'}"""\n' +
' slug: "word-script-sign-the-alphabet-of-art"\n' +
' date: "2024-01-30"\n' +
' }\n' +
' }\n' +
' ) {\n' +
' id\n' +
' }\n' +
' }',
variables: undefined
}
}