next-drupal: Not able to access paragraphs data

Hi, first and foremost, thanks for a great integration with Drupal!

We’re trying this out and we’re running into issues when trying to populate paragraphs data to our basic pages.

In [...slug].tsx we’re including field_content which holds all our paragraphs:

if (type === "node--page") {
  params = {
    include: "field_content",
  }
}

When we console.log our response (the entire node data) we can see that there is a paragraph called paragraph--hero which is good. But we can’t access the data nested inside the paragraph:

CleanShot 2022-06-20 at 08 16 19@2x

When we check our api-response locally (http://localhost/jsonapi/node/page?include=field_content), we can see that our nested paragraph data lives inside the included part of the response:

CleanShot 2022-06-20 at 08 13 36@2x

Sadly the included part is not available to us when we console log the entire node data:

CleanShot 2022-06-20 at 08 23 55@2x

Does anyone have a solution or know how to access the nested data? We need this to be able to build dynamic pages.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15

Most upvoted comments

Hi again @shadcn!

I continued to investigate this yesterday and it seems like I hadn’t configured the module Paragraphs Type Permissions properly.

After I configured that anonymous users would be able to view my Hero paragraph, the data is now showing up in my response.

CleanShot 2022-06-21 at 07 57 42@2x

Thanks for all your help and feedback!