Next.js Discord

Discord Forum

ISR on AWS Amplify

Answered
HRoot posted this in #help-forum
Open in Discord
version: 14.2.3
I have a section let's say hero section I am fetching data for the hero section and tagged the fetch function with "hero-section"
const res = await fetch("https://jsonplaceholder.typicode.com/todos", {
  next: { tags: ["hero-section"] },
});

const data = await res.json();

const random = Math.trunc(Math.random() * 40);

const dataToShow = data[random];


depending on the documentation to revalidate a tag I should use revalidateTag and pass it the tag I want to revalidate
I created a route handler on /app/api/revalidation/[tag]/route.ts
so every time I go to https:base-url/api/revalidation/hero-section the data will get updated
the code:
import { revalidateTag } from "next/cache";

export async function GET(_: Request, { params }: { params: { tag: string } }) {
    try {
        revalidateTag(params.tag);

        return Response.json({
            message: "Revalidated tag ${params.tag} successfully",
        });
    } catch (error) {
        return Response.json({ message: "something went wrong" });
    }
}


I built my app locally and tested everything was OK
after I deployed to amplify and I went went to the url where I do revalidation and returned to the page
the data didn't get revalidated. soo what's wrong;
Amplify doesn't support ISR or what ?!
Thanks in advance
Answered by HRoot
https://docs.aws.amazon.com/amplify/latest/userguide/ssr-Amplifysupport.html

Unsupported features
- Edge API Routes (Edge middleware is not supported)
- On-Demand Incremental Static Regeneration (ISR)
- Internationalized (i18n) automatic locale detection
- Next.js streaming
- Running middleware on static assets and optimized images
View full answer

4 Replies

&752637460550385834
Can anyone provide help ?
Or should I issue it at GitHub
Or maybe the next.js features aren't fully supported outside vercel !?
Asian black bear
Do not ping moderators for help, only for moderation purposes.
https://docs.aws.amazon.com/amplify/latest/userguide/ssr-Amplifysupport.html

Unsupported features
- Edge API Routes (Edge middleware is not supported)
- On-Demand Incremental Static Regeneration (ISR)
- Internationalized (i18n) automatic locale detection
- Next.js streaming
- Running middleware on static assets and optimized images
Answer