Skip to content

"uncaughtSuspenseError" error when previewing a draft document #546

@kb1995

Description

@kb1995

Versions

  • gatsby-source-prismic: ^6.0.1
  • gatsby-plugin-prismic-previews: ^6.0.1
  • gatsby: ^5.8.0
  • Node.js: 18

Steps to reproduce

I followed the documentation to upgrade to v6 - previews of already published documents work as expected, but draft documents are not working. I get the following error https://share.cleanshot.com/ZQKvmWtB

My repositoryConfig file looks like this:

import React from 'react';
import linkResolver from '@prismic/utils/linkResolver';

const HowToBuildPage = React.lazy(() => import('../../templates/howToBuild-template'));
const HowToDevelopPage = React.lazy(() => import('../../templates/howToDevelop-template'));
const ShowcasePost = React.lazy(() => import('../../templates/ShowcasePost/ShowcasePost'));
const BlogPost = React.lazy(() => import('../../templates/blogPost'));
const AcademyPost = React.lazy(() => import('../../templates/academyPost'));
const LandingPage = React.lazy(() => import('../../templates/landing'));
const AcademyLanding = React.lazy(() => import('../../templates/academyLanding'));
const Author = React.lazy(() => import('../../templates/author'));
const Category = React.lazy(() => import('../../templates/category'));
const PodcastEpisode = React.lazy(() => import('../../templates/podcastEpisode'));
const MarketplaceTypePage = React.lazy(() => import('../../templates/marketplaceTypePage'));
const FeatureHighlightPage = React.lazy(() => import('../../templates/featureHighlightPage'));
const LegalPage = React.lazy(() => import('../../templates/LegalPage/LegalPage'));

export const repositoryConfigs = [
  {
    repositoryName: process.env.GATSBY_PRISMIC_REPO_NAME,
    linkResolver,
    componentResolver: {
      how_to_build_page: HowToBuildPage,
      how_to_develop_page: HowToDevelopPage,
      showcase_post: ShowcasePost,
      blog_post: BlogPost,
      academy_post: AcademyPost,
      landing_page: LandingPage,
      academy_landing: AcademyLanding,
      person: Author,
      category: Category,
      podcast_episode: PodcastEpisode,
      marketplace_type_page: MarketplaceTypePage,
      feature_highlight_page: FeatureHighlightPage,
      legal_page: LegalPage,
    },
  },
];

If I remove the Lazy directive and just import the templates in the normal way, the error disappears

What is expected?

For the draft document to work as expected.

What is actually happening?

I get the above error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions