strapi / strapi-starter-next-corporate

Next.js starter for creating a corporate site with Strapi.
https://strapi-starter-next-corporate.vercel.app
MIT License
346 stars 95 forks source link

Warning: Failed prop type: The prop `media` is marked as required in `Image`, but its value is `undefined`. #55

Open cmsbased opened 3 years ago

cmsbased commented 3 years ago

Steps to replicate:

  1. yarn create strapi-starter my-site next-corporate
  2. Open http://localhost:3000/ and check Chrome browser dev console.

Shows prop type error right from the very start.

"react-jsx-dev-runtime.development.js:117 Warning: Failed prop type: The prop media is marked as required in Image, but its value is undefined."

abraham-yusuf commented 3 years ago

Warning: Failed prop type: The prop media is marked as required in Image, but its value is undefined. same the problem, i think need little configure in next.config.js but not work

DominiqueBertrand commented 2 years ago

Hi,

I'm facing the same issue.

Does anyone have any advice / solution to resolve this problem?

Thanks in advance.

pipozoft commented 2 years ago

Under this file starter/components/elements/image.js, you can make the media attribute of Image not required by changing line 34 from:

Image.propTypes = {
  media: mediaPropTypes.isRequired,
  className: PropTypes.string,
}

to

Image.propTypes = {
  media: mediaPropTypes,
  className: PropTypes.string,
}

That solved the issue for me. Hope it helps.

lKrayola commented 2 years ago

I was testing a clean install of this starter on my WSL Ubuntu yesterday and it worked perfectly.

Today I generated another clean install and for some reason I got this same error

Warning: Failed prop type: The prop media is marked as required in Image, but its value is undefined."

logos and images not rendering correctly. On top of that, @pipozoft 's workaround did not solved the issue for me.

Then I decided to generate it again on my manjaro laptop and it now renders all the images perfectly but it gives me this error instead.

TypeError: Cannot destructure property 'attributes' of 'strapi.getModel(...)' as it is undefined.