diff --git a/utilsApi/get-default-static-props.ts b/utilsApi/get-default-static-props.ts index aefc9807..95a3bde6 100644 --- a/utilsApi/get-default-static-props.ts +++ b/utilsApi/get-default-static-props.ts @@ -3,6 +3,7 @@ import type { ParsedUrlQuery } from 'querystring'; import Metrics from 'utilsApi/metrics'; import { fetchExternalManifest } from './fetch-external-manifest'; +import { config } from 'config'; export const getDefaultStaticProps = < P extends { [key: string]: any } = { [key: string]: any }, @@ -11,15 +12,14 @@ export const getDefaultStaticProps = < >( custom?: GetStaticProps
, ): GetStaticProps
=> { - let shouldZeroRevalidate = true; return async (context) => { /// common props - const { ___prefetch_manifest___, revalidate } = - await fetchExternalManifest(); + const { ___prefetch_manifest___ } = await fetchExternalManifest(); const props = ___prefetch_manifest___ ? { ___prefetch_manifest___ } : {}; const base = { props, - revalidate: shouldZeroRevalidate ? 1 : revalidate, + // because next only remembers first value, default to short revalidation period + revalidate: config.ERROR_REVALIDATION_SECONDS, }; /// custom getStaticProps @@ -35,11 +35,10 @@ export const getDefaultStaticProps = < /// metrics console.debug( - `[getDefaultStaticProps] running revalidation, next revalidation in ${base.revalidate}`, + `[getDefaultStaticProps] running revalidation, next revalidation in ${result.revalidate}`, ); Metrics.request.ssrCounter.labels({ revalidate: base.revalidate }).inc(1); - shouldZeroRevalidate = false; return result; }; }; diff --git a/utilsApi/rpcFactory.ts b/utilsApi/rpcFactory.ts index fd1fe239..81089660 100644 --- a/utilsApi/rpcFactory.ts +++ b/utilsApi/rpcFactory.ts @@ -222,9 +222,9 @@ export const rpcFactory = ({ .pipe(sizeLimit) .on('error', (error) => { if (error instanceof SizeTooLargeError) { - console.warn('[rpcFactory] RPC response too large', { - request: JSON.stringify(requests), - }); + console.warn( + `[rpcFactory] RPC response too large: ${JSON.stringify(requests)}`, + ); res.statusCode = 413; // Payload Too Large res.end(error.message); } else {