medusajs / medusa

Building blocks for digital commerce
https://medusajs.com
MIT License
24.45k stars 2.4k forks source link

Image error when add new product #7684

Open abdelrahman830a opened 2 months ago

abdelrahman830a commented 2 months ago

Bug report

Hi there, when I add a new product the Thumbnail, as well as the Media images do not show. The app tries to make a connection to: localhost:9000/uploads/${the-image} and gives me an error because I am on the live site, not locally. I tried to dig in the code, but couldn't find anything useful. Can anyone help me please?

lekterable commented 2 months ago

@abdelrahman830a what's your file service, @medusajs/file-local?

maybe try specifying the backend_url plugin option to your actual server url

podzolkov commented 2 months ago

Same error, any solutions?

lekterable commented 2 months ago

@podzolkov Same error, any solutions?

It's obviously an issue with your configuration, see my reply above.

humbleEwan commented 2 months ago

localhost:9000 is your local environment, not actual "open connection point". You need a bucket for images or setup medusa on the cloud and use that URL instead of localhost.

jantoine1 commented 1 week ago

In order to get this to work, I had to add the following to my medusa-config.js file. Is this the correct way to accomplish this? It was a bad developer experience to have to find the previous file config definition and copy it into my config. Surely I'm missing something?

module.exports = defineConfig({
  ...,
  modules: {
    ...,
    file: {
      resolve: "@medusajs/file",
      options: {
        providers: [
          {
            resolve: "@medusajs/file-local-next",
            id: "local",
            options: {
              backend_url: `https://my-medusa-storefront`,
            },
          },
        ],
      },
    },
  }
});

EDIT: Fixed the code example above to one that works!