I have a problem with the apiOptions.routes in the Prismic module.
In our project we have childeren under expertises which has a child that has a different layout called data-en-customer-intelligence (DCI). The first part of the DCI page has data which gets picked up by /services/expertises/:uid and ends up generating an error in the build and outputting a page without content.
I'm not quite sure how the page giving the error Cannot read property 'data' of undefined could be related to the route resolver in this case. Can you explain further or better yet share the code for the page which is not building correctly?
Thanks.
Phil
(Phil Snow)
closed , flag & select 'Something Else' to reopen.
4
This issue has been closed due to inactivity. Flag to reopen.
OK, Thanks for pointing this out, I see these errors now.
You'll be happy to learn I spent more than an hour trying to figure out why /actueel/at-work/at-work-max/ wasn't working instead of /actueel/at-work/max-at-work/
I then spent more time looking in to this and I don't think the issue is coming from the route resolver, as the route resolver doesn't really have anything to do here since there are no dynamic page folders in the /actueel/at-work/max-at-work/ route. For a route like this, since there are no dynamic folders, it's enough to use the link resolver.
The actual generation of that route is handled by Nuxt, which it seems is failing on that folder name because of the hyphen '-' like you suggested. If you remove this from the route resolver the same error occurs. I also noticed you were still you using the plugins 'Static' and 'Crawler' these are unnecessary as this is done by Nuxt now as I mentioned above. I removed these plugins, but no joy on the issue.
So to me, it seems like the issue is coming from either the nuxt or @prismic/nuxt plugins. I'm going to bring this up with the team and see what I can figure out about the issue.
One of the team thinks it's like you suggested an issue with how the apiOptions.routes option is processing that folder. The workaround now is just to use the linkresolver for this route and it should be fine. @lihbr Has created a ticket in the tracker about this.
OK, so it should work using just the linkresolver, in fact since none of your routes have dynamic folder names the link resolver is all you need right now.
Can you explain a little further what you mean by this?
If you look at the source version view-source:https://nostalgic-noether-e1c898.netlify.app/actueel/at-work/max-at-work none of the meta and content is showing up in the generated version and just has the default loader of nuxt in body. this should be generated content from that page.
I have tried but the older crawler and static plugin didn't work with that, I will change it to the newest implementation and try out the full static version.