Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Custom setting page not visible on production build #11145

Closed
mentalrob opened this issue Jan 24, 2025 · 2 comments
Closed

[Bug]: Custom setting page not visible on production build #11145

mentalrob opened this issue Jan 24, 2025 · 2 comments

Comments

@mentalrob
Copy link

Package.json file

{
  "name": "medusa-reproduction",
  "version": "0.0.1",
  "description": "A starter for Medusa 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.3.1",
    "@medusajs/cli": "2.3.1",
    "@medusajs/framework": "2.3.1",
    "@medusajs/medusa": "2.3.1",
    "@medusajs/ui": "^4.0.3",
    "@mikro-orm/core": "5.9.7",
    "@mikro-orm/knex": "5.9.7",
    "@mikro-orm/migrations": "5.9.7",
    "@mikro-orm/postgresql": "5.9.7",
    "awilix": "^8.0.1",
    "pg": "^8.13.0"
  },
  "devDependencies": {
    "@medusajs/test-utils": "2.3.1",
    "@mikro-orm/cli": "5.9.7",
    "@swc/core": "1.5.7",
    "@swc/jest": "^0.2.36",
    "@types/jest": "^29.5.13",
    "@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.6.2",
    "vite": "^5.2.11",
    "yalc": "^1.0.0-pre.53"
  },
  "engines": {
    "node": ">=20"
  },
  "packageManager": "[email protected]+sha512.76e2379760a4328ec4415815bcd6628dee727af3779aaa4c914e3944156c4299921a89f976381ee107d41f12cfa4b66681ca9c718f0668fa0831ed4c6d8ba56c"
}

Node.js version

v22.12.0

Database and its version

latest

Operating system name and version

windows 10

Browser name

chrome

What happended?

I've created a file under src/admin/routes/settings/custom/page.tsx with content of:

import { defineRouteConfig } from "@medusajs/admin-sdk"
import { Container, Heading } from "@medusajs/ui"

const TrendyolSettingsPage = () => {
  console.log("SHOULD WORK SHOULD WORK")
  return (
    <Container className="divide-y p-0">
      <div className="flex items-center justify-between px-6 py-4">
        <Heading level="h1">Custom Setting Page</Heading>
      </div>
    </Container>
  )
}

export const config = defineRouteConfig({
  label: "Custom",
})

export default TrendyolSettingsPage

It works fine in development but when i do

pnpm run build
cd .medusa/server
pnpm install
cp ..\..\.env .
pnpm run start

And open a production instance, it's not showing the custom settings on the left menu.
I followed these docs:

Expected behavior

I want to see the custom settings page i created on production

Actual behavior

I don't see the custom settings page i created on production

Link to reproduction repo

https://github.com/mentalrob/medusa-reproduction

@saranshisatgit
Copy link

saranshisatgit commented Jan 27, 2025

Probably run the admin build also

npx medusa build --admin-only

@mentalrob
Copy link
Author

Probably run the admin build also

npx medusa build --admin-only

Okay that works, but in order to run this i used this config:

  admin: {
    backendUrl: "http://localhost:9000",
    path: "/",
    disable: true
  },

And it created a folder under .medusa/admin, to serve from there i need to use a seperate http server from medusa's, (I used python3.12 -m http.server to test it)

But if there was a option for medusa where i can serve the admin build from medusa's http server (like a public directory)

Also i tried to create a public directory under .medusa/server/public and put a file there helloworld.txt but it returns 404 when i try to hit it.

This partially solves my problem for now. Thank you for the answer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants