Irushan
Irushan

Reputation: 155

og:image URL error: https://mydomain/session/upload/undefined could not be processed as an image because it has an invalid content type

Here I used to debug the above URL using Facebook sharing debugger. I have this message after debugged.

Invalid Image Content Provided og:image URL, https://mydomain/session/upload/undefined could not be processed as an image because it has an invalid content type.

I have used Next.js, and my head tag include:

<meta
    property="og:image"
    content={`${apiUrl}/session/upload/${session?.image}`}
/>

How can I solve this?

Upvotes: 1

Views: 1168

Answers (1)

andyrandy
andyrandy

Reputation: 73984

The image path is "..../undefined", that image most likely does not exist.

Make sure ${session?.image} is not undefined. You could also use a fallback image in case it is not defined, for example:

<meta
    property="og:image"
    content={session?.image ? `${apiUrl}/session/upload/${session.image}` : 'fallback-image-url'}
/>

Upvotes: 1

Related Questions