next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

failed to load include fields on production mode by blocks

Open taskrider2022 opened this issue 3 years ago • 1 comments

Hi,

I load blocks with with getResourceObjectFromContext in the getStaticProps

const [footerContact] = await drupal.getResourceCollectionFromContext<any>( 'block_content--footer', context, { params: getParams({ name: 'block_content--footer' }) .addInclude(['field_form']) .addFilter('info', 'footer-contact') .getQueryObject(), } );

This is a normal block element and I filter this by his info. The getParams function is a copy of the Umami example from you.

if (name === 'block_content--footer') { return params.addFields(name, [ 'field_headline', 'field_form', 'body', 'field_icon', 'field_link', ]); }

My problem is:

In the local environment is no problem to load the form. But if I develop this in production mode, the include field will not return any relationships anymore, so I became a empty form only with the relationship information but no content.

taskrider2022 avatar Sep 19 '22 10:09 taskrider2022

Hmm. Is there any difference, say permissions, on your prod site vs the dev one? If the relationship field_form exists and the Next.js site has access to it, it should behave the same way on both prod and dev.

shadcn avatar Sep 22 '22 10:09 shadcn