Hello,
I have set the preview mode using nextjs, and it all worked out okay. Recently, we started using i18next for some translations we don't need in prismic, so our getStaticProps looks like:
export const getStaticProps: GetStaticProps<Props, Query> = async ({
preview = false,
previewData = {},
params,
locale,
}) => {
if (!params?.uid) {
return Promise.reject('params are mandatory');
}
const cli = Client();
let lang = localeToPrismic(locale);
const { ref } = previewData as { ref: string | number | string[] };
const [topnav, doc, cta, footer, cookies, translations] = await Promise.all([
cli.getSingle('top_navigation', {
ref,
lang,
}),
cli.getByUID('page', params.uid, {
ref,
lang,
}),
cli.getByUID('cta', 'cta', {
ref,
lang,
}),
cli.getByUID('footer', 'footer', {
ref,
lang,
}),
cli.getByUID('cookies', 'cookies', {
ref,
lang,
}),
serverSideTranslations(locale ? locale : 'en', ['common', 'pricing']),
]);
return {
props: {
topnav,
doc,
cta,
footer,
cookies,
...translations,
preview,
},
revalidate: 1,
};
};
For all the pages that have the ...translations
variable, the prismic preview returns a 500, all the others work perfectly okay.
Do you have any clue what it could be?
Thanks in advance,
Mariana