Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Failing to generate new pages after build(ISR) #2563

@Karlen92

Description

@Karlen92
Mac OS Ventura
Next.JS - 12.3.0
Node.JS version - 16.19.0
sls-next/serverless-component - 3.7.0
Serverless Version
  Framework Core: 3.25.1
  Plugin: 6.2.2
  SDK: 4.3.2

Content of serverless.yml

    component: "./node_modules/@sls-next/serverless-component"
    inputs:
      roleArn: "arn:aws:iam::656114780823:role/nygvfxo-ufm55u8" # has admin permissions

The deployment works fine, I deploy from my machine, without any errors.

I'm trying to enable ISR on my project to be able ti generate pages and my getStaticProps looks like this

const OfferingPage: FC<{ offeringData: { data: Offering } }> = () => {
  const router = useRouter();
  return <main className="site-main hfeed" id="main">
      <div data-elementor-type="wp-page" data-elementor-id="2952" className="elementor elementor-2952">
        <div>The ID is {router?.query?.offering_id}</div>
      </div>
  </main>
};


export const getStaticProps: GetStaticProps = async (context) => {
     // I removed every logic from here for simplicity
  return {
    props: {
      offeringData: {},
    },
    revalidate: 60
  };
};

export const getStaticPaths: GetStaticPaths = async () => {
  const responsePremium = await AxiosApiService.getIds(true); 
  const paths = responsePremium?.data?.map((item: string) => {
    return {
      params: { offering_id: item },
    };
  });
  return {
    paths,
    fallback: true,
  };
};

Actual behavior

I have a url structure like this https://d1ut6e5vnq8i6g.cloudfront.net/offering/{:id}/. If the id exists in my getStaticPaths, it works fine. However when id is new, and I assume that's when regeneration should happen. However, in those cases application fails with he following error.

Application error: a client-side exception has occurred (see the browser console for more information).
This is the browser console log.
Screenshot 2023-01-22 at 18 05 25

Seems like the issue is the 404 request to get static props, which works fine for all existing ids.
https://d1ut6e5vnq8i6g.cloudfront.net/_next/data/99wTahfTVhXTAQeDVyzQ3/offering/991a5af4-57ed-4822-855c-02ce590dbd71.json?offering_id=991a5af4-57ed-4822-855c-02ce590dbd71

*note all application logic is removed form the code for simplicity, so my code is exactly as above.

The Lambda for regeneration is being called as expected, it seems, without error, but the files are not added to S3, and no lambda is called besides regeneration lambda(not sure when they meant to).

Expected behavior

I expect the page to be generated on request and returned which does not happen.
Can anyone relate the issue, or might be I'm using wrong configuration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions