generateMetadata returning old data?
Answered
Transvaal lion posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Transvaal lionOP
This is my server component rendering this page based on the id
I need to get the data.image_2d_front image url which is in my database - as I just updated but the generateMetadata function is returning null for those fields and not bringing back new columns?
Is this a cache issue or am I not doing something correctly? Any help will be greatly appreciated!!
export default async function Page({ params }: { params: { id: number } }) {
return (
<div className="flex flex-col justify-center items-center w-full gap-8 mt-12">
<ClaimPage id={params.id as number} />
</div>
);
}
export async function generateStaticParams(): Promise<{ id: string }[]> {
const { data, error } = await supabase
.from("my_table")
.select("*");
return data!.map((d: Phygital) => ({
id: d.cert_id.toString(),
}));
}
type Props = {
params: { id: number };
};
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const id = params.id;
const { data, error } = await supabase
.from("my_table")
.select("*")
.eq("cert_id", id)
.single();
let openGraphFrontImage = data.image_2d_front;
return {
title: data?.name,
description: `Claim page for ${data.name}`,
openGraph: {
title: data?.name,
description: `Claim page for ${data.name}`,
},
};
}
I need to get the data.image_2d_front image url which is in my database - as I just updated but the generateMetadata function is returning null for those fields and not bringing back new columns?
Is this a cache issue or am I not doing something correctly? Any help will be greatly appreciated!!
Answered by Transvaal lion
yeah Im dumb - I wasnt exporting the revalidate variable in my component....
5 Replies
![Avatar](https://cdn.discordapp.com/avatars/657067112434499595/c78dd8e985ede1ad50c31ac682dd91a1.webp?size=256)
risky
is there a chance that supabase is caching?
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Transvaal lionOP
That is what I am currently looking into right now
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Transvaal lionOP
yeah Im dumb - I wasnt exporting the revalidate variable in my component....
Answer
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Transvaal lionOP
lol thank you for responding though! 🫡
![Avatar](https://cdn.discordapp.com/embed/avatars/3.png)
Transvaal lionOP
Hey curious - if you know how to resize the opengraph metadata image? when I set it from my database call it is super cropped