swellstores / horizon

Headless NextJS storefront starter powered by Swell
https://swell-horizon-demo.vercel.app/
MIT License
58 stars 52 forks source link

Product images do not show up in the production site #47

Closed shumiyao closed 1 year ago

shumiyao commented 1 year ago

Don't we need 'cdn.swell.store' in the next.config.js so that the images from the domain are allowed to be accessed?

https://github.com/swellstores/horizon/blob/39df509bccbf74774ed32d18cc84a395385facb3/next.config.js#L9

Thank you for your attention in advance/

holden commented 1 year ago

I'm having the same or similar issue with cdn.swell.store trying to load images in development.

Unhandled Runtime Error
Error: Invalid src prop [(https://cdn.swell.store/cirqus-marketplace/6475b1306fa54e0012f89985/bcf5c880882c4c48afd72464be461927/5fa3dd1b51410ef7bfff33ac_WinterMurder-p-800.png)](http://localhost:3000/(https://cdn.swell.store/cirqus-marketplace/6475b1306fa54e0012f89985/bcf5c880882c4c48afd72464be461927/5fa3dd1b51410ef7bfff33ac_WinterMurder-p-800.png)) on `next/image`, hostname "cdn.swell.store" is not configured under images in your `next.config.js`
See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host

Unless I left something undefined somewhere?

shumiyao commented 1 year ago

that is easy to fix.

you have to edit horizon/next.config.js

 domains: [ 'cdn.swell.store' , 'cdn.schema.io', ...(isDev ? ['cdn.swell.test'] : [])],

you only need to add 'cdn.swell.store' to the array in the settings for images.domains

aanomm commented 1 year ago

thanks for the fix @shumiyao 🙏🏾

logeshswell commented 1 year ago

It is fixed in the latest horizon release v0.5.0