Skip to content

[Bug]: Product Images URL on custom backend port still defaults to localhost:9000 #194

@krishna-404

Description

@krishna-404

Package.json file

{
  "name": "medusa-b2b-starter",
  "version": "0.0.1",
  "description": "A starter for Medusa B2B projects.",
  "author": "Medusa (https://medusajs.com)",
  "license": "MIT",
  "keywords": [
    "sqlite",
    "postgres",
    "typescript",
    "ecommerce",
    "headless",
    "medusa"
  ],
  "scripts": {
    "build": "medusa build",
    "seed": "medusa exec ./src/scripts/seed.ts",
    "start": "medusa start",
    "dev": "medusa develop",
    "test:integration:http": "TEST_TYPE=integration:http NODE_OPTIONS=--experimental-vm-modules jest --silent=false --runInBand --forceExit",
    "test:integration:modules": "TEST_TYPE=integration:modules NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit",
    "test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit"
  },
  "dependencies": {
    "@medusajs/admin-sdk": "2.8.4",
    "@medusajs/cli": "2.8.4",
    "@medusajs/framework": "2.8.4",
    "@medusajs/js-sdk": "2.8.4",
    "@medusajs/medusa": "2.8.4",
    "@medusajs/ui": "4.0.14",
    "@mikro-orm/core": "6.4.3",
    "@mikro-orm/knex": "6.4.3",
    "@mikro-orm/migrations": "6.4.3",
    "@mikro-orm/postgresql": "6.4.3",
    "awilix": "^8.0.1",
    "pg": "^8.13.0",
    "zod": "3.22.4"
  },
  "devDependencies": {
    "@medusajs/test-utils": "2.8.4",
    "@medusajs/ui-preset": "2.8.4",
    "@mikro-orm/cli": "6.4.3",
    "@swc/core": "^1.5.7",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.14",
    "@types/node": "^20.0.0",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "jest": "^29.7.0",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.5.3",
    "vite": "^5.2.11"
  },
  "engines": {
    "node": ">=20"
  },
  "packageManager": "yarn@4.4.0"
}

Node.js version

v22.16.0

Operating system name and version

mac OS 15.5

Browser name

Brave / Chrome

What happended?

I tried setting up https://github.com/medusajs/b2b-starter-medusa on my local.

My 9000 port was being used by some PHP service & sounds like apple needs it. Doesnt allow me to kill it 🤷‍♂️

So I moved the backend to port 9001. Everything works fine other then when fetching product detail. Below is what I get in the product-json response.

"images": [
            {
                "id": "img_01K809S7XGN7PTGTRSQ530N6N9",
                "url": "http://localhost:9000/static/1760946855788-product_image.png",
                "metadata": null,
                "rank": 0,
                "product_id": "prod_01K806G7DKYVYNSA2TTQD8N7T8",
                "created_at": "2025-10-20T07:54:15.858Z",
                "updated_at": "2025-10-20T07:54:15.858Z",
                "deleted_at": null
            }
        ],

Expected behavior

The port in images.url should be 9001 but it seems to be hardcoded somewhere?

Actual behavior

The port in images.url wrongly is 9000.

Link to reproduction repo

https://github.com/medusajs/b2b-starter-medusa

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions