Good day!
Could you please help me with migration from old to new Gatsby Prismic integaration plugin? I set up two pages, they work normally with new plugin. Now I am setting up next page. This page is template, it has 11 different pages. The problem is that 9 of 11 pages are available and work. But I can query 2 remaining pages of 11. GraphQL playground does not see them. And I have mistake:
"gatsby-source-prismic" threw an error while running the sourceNodes lifecycle:
Cannot read property 'reduce' of null
TypeError: Cannot read property 'reduce' of null
These page are available with old plugin gatsby-source-prismic-graphql. I check data in Prismic — it is identical both for problem and non-problem pages.
Hi, @Pau, thank you. The query is below. I can get 9 of 11 pages of this custom type by this query. And I can query all pages of other custom type by identical query. The query:
export const query = graphql`
query($uid: String, $lang: String) {
allPrismicSolutionpage(filter: { uid: { eq: $uid }, lang: { eq: $lang } }) {
edges {
node {
alternate_languages {
id
lang
uid
type
}
data {
canonical {
raw
}
metadescription {
raw
}
metatitle {
raw
}
body {
... on PrismicSolutionpageBodyHero {
id
slice_type
primary {
buttonlink {
text
}
buttontext {
text
}
description {
text
}
modalctabuttonlink {
text
}
modalctabuttontext {
text
}
modalvideo {
link_type
url
}
previewimage {
url
fluid(srcSetBreakpoints: 10) {
aspectRatio
base64
sizes
src
srcSet
srcSetWebp
srcWebp
}
thumbnails
}
title {
text
}
videobuttontext {
text
}
}
items {
partnerslogo {
alt
url
}
}
}
... on PrismicSolutionpageBodyProjects {
id
slice_type
primary {
title {
raw
}
}
items {
description {
raw
}
title {
raw
}
link {
url
link_type
}
screenshot {
alt
url
fluid(srcSetBreakpoints: 10) {
aspectRatio
base64
sizes
src
srcSet
srcSetWebp
srcWebp
}
thumbnails
}
}
}
... on PrismicSolutionpageBodyQuestions {
id
slice_type
primary {
title {
raw
}
}
items {
content {
raw
}
link {
link_type
url
}
scan
linktext {
text
}
title {
raw
}
}
}
... on PrismicSolutionpageBodyBenefits {
id
slice_type
primary {
button {
text
}
buttonlink {
text
}
title {
raw
}
}
items {
image {
alt
url
}
text {
raw
}
}
}
... on PrismicSolutionpageBodyFeatures {
id
slice_type
primary {
button {
text
}
buttonlink {
text
}
title {
raw
}
}
items {
description {
raw
}
image {
alt
url
}
title {
raw
}
}
}
... on PrismicSolutionpageBodyBooking {
id
slice_type
primary {
title {
raw
}
}
}
... on PrismicSolutionpageBodyPlans {
id
slice_type
primary {
title {
raw
}
}
}
}
}
uid
type
id
lang
}
}
}
allPrismicLayout {
edges {
node {
data {
body2 {
... on PrismicLayoutBody2Agencies {
id
slice_type
primary {
buttontext {
text
}
description {
text
}
image {
alt
url
}
link {
link_type
url
}
page {
text
}
title {
text
}
}
}
... on PrismicLayoutBody2Plans {
id
slice_type
items {
benefits {
raw
}
button {
raw
}
buttonlink {
link_type
url
}
buttonprice {
raw
}
cardtitle {
raw
}
description {
raw
}
image {
alt
url
}
type
}
}
}
}
}
}
}
}
`;
They are published. And I can query them with old plugin. All 11 pages are available. But with new plugin I get only 9 from 11 pages. When I add new pages of that custom type, they are abailable.
Hi, @Pau. Thank you for helping me. The query is published here already, but I will do it again in this message. The URL of repository and uid of problem pages I will send you in direct message.
the query:
export const query = graphql`
query($uid: String, $lang: String) {
allPrismicSolutionpage(filter: { uid: { eq: $uid }, lang: { eq: $lang } }) {
edges {
node {
alternate_languages {
id
lang
uid
type
}
data {
canonical {
raw
}
metadescription {
raw
}
metatitle {
raw
}
body {
... on PrismicSolutionpageBodyHero {
id
slice_type
primary {
buttonlink {
text
}
buttontext {
text
}
description {
text
}
modalctabuttonlink {
text
}
modalctabuttontext {
text
}
modalvideo {
link_type
url
}
previewimage {
url
fluid(srcSetBreakpoints: 10) {
aspectRatio
base64
sizes
src
srcSet
srcSetWebp
srcWebp
}
thumbnails
}
title {
text
}
videobuttontext {
text
}
}
items {
partnerslogo {
alt
url
}
}
}
... on PrismicSolutionpageBodyProjects {
id
slice_type
primary {
title {
raw
}
}
items {
description {
raw
}
title {
raw
}
link {
url
link_type
}
screenshot {
alt
url
fluid(srcSetBreakpoints: 10) {
aspectRatio
base64
sizes
src
srcSet
srcSetWebp
srcWebp
}
thumbnails
}
}
}
... on PrismicSolutionpageBodyQuestions {
id
slice_type
primary {
title {
raw
}
}
items {
content {
raw
}
link {
link_type
url
}
scan
linktext {
text
}
title {
raw
}
}
}
... on PrismicSolutionpageBodyBenefits {
id
slice_type
primary {
button {
text
}
buttonlink {
text
}
title {
raw
}
}
items {
image {
alt
url
}
text {
raw
}
}
}
... on PrismicSolutionpageBodyFeatures {
id
slice_type
primary {
button {
text
}
buttonlink {
text
}
title {
raw
}
}
items {
description {
raw
}
image {
alt
url
}
title {
raw
}
}
}
... on PrismicSolutionpageBodyBooking {
id
slice_type
primary {
title {
raw
}
}
}
... on PrismicSolutionpageBodyPlans {
id
slice_type
primary {
title {
raw
}
}
}
}
}
uid
type
id
lang
}
}
}
allPrismicLayout {
edges {
node {
data {
body2 {
... on PrismicLayoutBody2Agencies {
id
slice_type
primary {
buttontext {
text
}
description {
text
}
image {
alt
url
}
link {
link_type
url
}
page {
text
}
title {
text
}
}
}
... on PrismicLayoutBody2Plans {
id
slice_type
items {
benefits {
raw
}
button {
raw
}
buttonlink {
link_type
url
}
buttonprice {
raw
}
cardtitle {
raw
}
description {
raw
}
image {
alt
url
}
type
}
}
}
}
}
}
}
}
`;
@Pau, good day. I solved the problem with two pages. There was empty content field on each problem page. Old plugin worked with this problem, and new plugin force me to find this problem. Thank you for help!