Expand my Community achievements bar.

SOLVED

I wrote GraphQL Query and executed. Igot error like mentioned below. can any one help me to resolve this ?

Avatar

Level 2

QUERY

query{
seaBrightByPath(_path:"/conf/bright/settings/dam/cfm/models/seabright"){
item {
firstName
lastName
email
}
}
}

 

Response i got

{
"errors": [
{
"message": "Failed to execute 'text' on 'Response': body stream already read",
"stack": "TypeError: Failed to execute 'text' on 'Response': body stream already read\n at http://localhost:4502/content/graphiql.html:81:33\n at async https://unpkg.com/graphiql/graphiql.min.js:29:224769"
}
]
}

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@Anilkumar0208 

 

This is essentially a CSRF issue, as pointed by others. Please check below link :

https://www.albinsblog.com/2021/10/how-to-deliver-headless-content-through-graphql-api-and-content-f...

 

Please follow similar thread here:

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem6-5-sp13-graphql-not-wo...

 

The path you are referring is Content Fragment Model Path, and not the Content Fragment itself. The query you are referring in above code, is looking for a CF Path, please check sample query below and link to the basic queries:
https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-ap...

 

{
cityByPath (_path: "/content/dam/sample-content-fragments/cities/berlin") {

item {
_path
name
country
population
categories
}
}
}

View solution in original post

6 Replies

Avatar

Level 2

Hii @TarunKumar 

I tried the way as you mentioned, but its not working. I thought it might not be issue with CSRF filter.

Thank you.

Avatar

Community Advisor

Hi @Anilkumar0208 

This can be an issue with CSRF filter

Please follow the below thread to get more info on the similar issue.

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/graphiql-editor-error-on-a...

Hope this is helpful

Avatar

Level 2

Hii @Mani_kumar_ 

I tried the way as you mentioned, but its not working. I thought it might not be issue with CSRF filter.

Thank you.

Avatar

Community Advisor

Hi @Anilkumar0208 

Please check your field names and paths .

Please ref this URL

https://issues.apache.org/jira/browse/SLING-9847

This may help you 

 

Thanks

Avatar

Correct answer by
Employee Advisor

@Anilkumar0208 

 

This is essentially a CSRF issue, as pointed by others. Please check below link :

https://www.albinsblog.com/2021/10/how-to-deliver-headless-content-through-graphql-api-and-content-f...

 

Please follow similar thread here:

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem6-5-sp13-graphql-not-wo...

 

The path you are referring is Content Fragment Model Path, and not the Content Fragment itself. The query you are referring in above code, is looking for a CF Path, please check sample query below and link to the basic queries:
https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-ap...

 

{
cityByPath (_path: "/content/dam/sample-content-fragments/cities/berlin") {

item {
_path
name
country
population
categories
}
}
}