Next.js Discord

Discord Forum

Can not deploy static page , how to fix this problem?

Unanswered
missing1307 posted this in #help-forum
Open in Discord
I deploy my code to production server. But it's show me this error. I use wordpress as the backend, and nextjs get the posts from wordpress. It's headless wordpress. All my post is approximately 600 posts, before that, it's work as usual, but recently, the deploy to production server fail frequently. I completely don't understand where the problem come from. If anyone has experience, please guide me the cause of this problem. Here is my example code related to static page.Thank you so much

export const getStaticProps: GetStaticProps<{
  messages: IntlMessages;
  categories: IPortfolioCategory[];
}> = async _context => {
  let categories = portfolioCategories.en;
  let i = 0;
  for (const c of categories) {
    const cat = await client.query<RootQuery>({
      query: QUERY_POSTS_BY_CATEGORY,
      variables: {
        limit: 999,
        offset: 0,
        lang: i18n.defaultLocale,
        categoryName: c.slug
      }
    });

    categories[i].data = cat?.data?.posts as PostFormatToPostConnection;
    i++;
  }
  return {
    props: {
      categories,
      messages: (await import(`../../i18n/json/${i18n?.defaultLocale}.json`))
        .default
    }
  };
};

1 Reply

Here are another response from the terminal
err: ApolloError: Response not successful: Received status code 524
err:     at new ApolloError (/home/ltsadmin/ltsweb/pro_frontend/node_modules/@apollo/client/errors/errors.cjs:34:28)
err:     at /home/ltsadmin/ltsweb/pro_frontend/node_modules/@apollo/client/core/core.cjs:1853:19
err:     at both (/home/ltsadmin/ltsweb/pro_frontend/node_modules/@apollo/client/utilities/utilities.cjs:1072:53)
err:     at /home/ltsadmin/ltsweb/pro_frontend/node_modules/@apollo/client/utilities/utilities.cjs:1065:72
err:     at new Promise (<anonymous>)
err:     at Object.then (/home/ltsadmin/ltsweb/pro_frontend/node_modules/@apollo/client/utilities/utilities.cjs:1065:24)
err:     at Object.error (/home/ltsadmin/ltsweb/pro_frontend/node_modules/@apollo/client/utilities/utilities.cjs:1073:49)
err:     at notifySubscription (/home/ltsadmin/ltsweb/pro_frontend/node_modules/zen-observable/lib/Observable.js:140:18)
err:     at onNotify (/home/ltsadmin/ltsweb/pro_frontend/node_modules/zen-observable/lib/Observable.js:179:3)
err:     at SubscriptionObserver.error (/home/ltsadmin/ltsweb/pro_frontend/node_modules/zen-observable/lib/Observable.js:240:7)

Is it related to the ApolloServer, espescially the network in the server wordpress