Open Karlen92 opened 1 year ago
To prove that ISR is working, a timestamp is shown on the page.
ISR is working on localhost, but once deployed to AWS, it uses the same pre-rendered page even with revalidation.
Next.JS - 12.1.6
Node.JS version - 16.7.0
sls-next/serverless-component - 3.6.0
Serverless Version
Framework Core: 2.72.2
Plugin: 5.5.4
SDK: 4.3.2
Components: 3.18.2
ContentPages:
component: "@sls-next/serverless-component@3.6.0"
inputs:
timeout:
apiLambda: 30
bucketName: ${env.SERVERLESS_BUCKET_NAME}
name:
defaultLambda: ${env.SERVERLESS_LAMBDA_NAME}
policy: "arn:aws:iam::xxxxx:policy/Serverless-IAM-Policy"
useServerlessTraceTarget: true
build: true
verbose: false
getStaticPaths
to get revalidation to work, but failed. Cloudwatch logs did not show any new rendering of pages.Application error: a client-side exception has occurred (see the browser console for more information).
return {
paths: [],
fallback: true,
};
Application error: a client-side exception has occurred (see the browser console for more information).
return {
paths: [selected list of paths],
fallback: true,
};
return {
paths: [all possible paths],
fallback: true,
};
return {
paths: [all possible paths],
fallback: 'dynamic',
};
export const getStaticProps = async (context: { params: { handle } }) => {
const {
params: { handle },
} = context;
const time = displayTriggerTime();
const { props } = await fetchPage({ handle });
if (props) {
return {
props: { ...props, pageData: JSON.stringify(props?.pageData), time },
revalidate: 30,
};
} else {
return { notFound: true };
}
};
Content of serverless.yml
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 thisActual behavior
I have a url structure like this
https://d1ut6e5vnq8i6g.cloudfront.net/offering/{:id}/
. If theid
exists in mygetStaticPaths
, it works fine. However whenid
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.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?