15 days ago
redisUrl not found. A fake redis instance will be used.
redisUrl not found. A fake redis instance will be used.
Skipping instrumentation registration. No register function found.
redisUrl not found. A fake redis instance will be used.
Pg connection failed to connect to the database. Retrying... {"name":"KnexTimeoutError","sql":"SELECT 1"}
Pg connection failed to connect to the database. Retrying... {"name":"KnexTimeoutError","sql":"SELECT 1"}
Pg connection failed to connect to the database. Retrying... {"name":"KnexTimeoutError","sql":"SELECT 1"}
Pg connection failed to connect to the database. Retrying... {"name":"KnexTimeoutError","sql":"SELECT 1"}
20 Replies
15 days ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
15 days ago
Hey, how are you reading your Redis URL and is it defined within your service's variable tab (using reference variables)?
15 days ago
yes. Now i am getting Error starting server Could not find index.html in the admin build directory. Make sure to run 'medusa build' before starting the server. I added process.env.MEDUSA_ADMIN_DISABLED = "true" in medusa config file
14 days ago
i tried this also instead
DISABLE_MEDUSA_ADMIN=true but it is giving the same error
ymeenakpm-eng
yes. Now i am getting Error starting server Could not find index.html in the admin build directory. Make sure to run 'medusa build' before starting the server. I added process.env.MEDUSA_ADMIN_DISABLED = "true" in medusa config file
14 days ago
Hey, can you show your scripts in your package.json? This sounds like that you didn't build your service correctly.
14 days ago
Hi,
if you're using internal redis, make sure you add ?family=0 to your medusa backend.
14 days ago
{
"name": "vams-medusa",
"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=false --runInBand --forceExit",
"test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit"
},
"dependencies": {
"@medusajs/admin-sdk": "2.11.3",
"@medusajs/cli": "2.11.3",
"@medusajs/framework": "2.11.3",
"@medusajs/medusa": "2.11.3"
},
"devDependencies": {
"@medusajs/test-utils": "2.11.3",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.13",
"@types/node": "^20.12.11",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.2.25",
"jest": "^29.7.0",
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"vite": "^5.4.14",
"yalc": "^1.0.0-pre.53"
},
"engines": {
"node": ">=20"
}
}
14 days ago
redisUrl not found. A fake redis instance will be used. = is usually because the app cant connect to the redisUrl, check if you have added the correct variable reference. if you are using internal redis, kindly add ?family=0 for that to work.
Pg connection failed to connect to the database. Retrying... {"name":"KnexTimeoutError","sql":"SELECT 1"} = check your postgres connection, make sure you use the correct variable reference.
also make sure you have redisURL on your env and correctly configure on medusa-config
MEDUSA_ADMIN_DISABLED = you can remove
DISABLE_MEDUSA_ADMIN = do not set true unless its the instance of worker.
you can test this using both redis and postgres public urls directly on your medusa backend service.
Status changed to Awaiting Conductor Response chandrika • 14 days ago
12 days ago
m warn config production Use --omit=dev instead.
> vams-medusa@0.0.1 start
> medusa start
Skipping instrumentation registration. No register function found.
No link to load from /app/node_modules/@medusajs/draft-order/.medusa/server/src/links. skipped.
Local Event Bus installed. This is not recommended for production.
Locking module: Using "in-memory" as default.
No workflow to load from /app/node_modules/@medusajs/draft-order/.medusa/server/src/workflows. skipped.
No subscriber to load from /app/node_modules/@medusajs/draft-order/.medusa/server/src/subscribers. skipped.
Could not find index.html in the admin build directory. Make sure to run 'medusa build' before starting the server.
No job to load from /app/node_modules/@medusajs/medusa/dist/jobs. skipped.
No job to load from /app/node_modules/@medusajs/draft-order/.medusa/server/src/jobs. skipped.
Error starting server. When i give DISABLE_MEDUSA_ADMIN=true, it works but i have to use vams_custom_admin to talk to medusa. cant i directly talk to medusa
12 days ago
STORE_CORS=http://localhost:8000,https://docs.medusajs.com
ADMIN_CORS=http://localhost:5173,http://localhost:9000,https://docs.medusajs.com
AUTH_CORS=http://localhost:5173,http://localhost:9000,https://docs.medusajs.com
REDIS_URL=redis://default:Uu...3?family=0
JWT_SECRET=.... taken from variables
COOKIE_SECRET=.... taken from variables
DATABASE_URL=postgresql://postgres:CCRu.../railway
DB_NAME=medusa_vams_biome_store
postgresql://postgres:CC...5/railway this is in my vams-medusa folder on my laptop.......................// medusa-config.ts
import { loadEnv, defineConfig } from "@medusajs/framework/utils"
// Load environment variables based on NODE_ENV
loadEnv(process.env.NODE_ENV || "development", process.cwd())
// Common CORS origins (store, admin, frontend)
const cors =
"http://localhost:3000," + // local frontend
"http://localhost:7001," + // local/docker admin
"https://vams-.....vercel.app," + // deployed frontend (legacy)
"https://vamsbiome.com," + // production storefront
"https://admin.vamsbiome.com," + // production custom admin UI domain
"https://vams.....l.app" // fallback admin UI on vercel.app
export default defineConfig({
projectConfig: {
// Railway DB + Redis
databaseUrl: process.env.DATABASE_URL,
redisUrl: process.env.REDIS_URL,
http: {
storeCors: cors,
adminCors: cors,
authCors: cors,
jwtSecret: process.env.JWT_SECRET || "supersecret",
cookieSecret: process.env.COOKIE_SECRET || "supersecret",
},
},
//
IMPORTANT: disable bundled admin when env says so
admin: {
// When DISABLE_MEDUSA_ADMIN="true" (string), this becomes true
disable: process.env.DISABLE_MEDUSA_ADMIN === "true",
},
}) this is the medusa-config.ts ...............{
"name": "vams-medusa",
"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=false --runInBand --forceExit",
"test:unit": "TEST_TYPE=unit NODE_OPTIONS=--experimental-vm-modules jest --silent --runInBand --forceExit",
"create-admin-api-key": "medusa exec ./src/scripts/create-admin-api-key.ts"
},
"dependencies": {
"@medusajs/admin-sdk": "2.11.3",
"@medusajs/cli": "2.11.3",
"@medusajs/framework": "2.11.3",
"@medusajs/medusa": "2.11.3"
},
"devDependencies": {
"@medusajs/test-utils": "2.11.3",
"@swc/core": "^1.7.28",
"@swc/jest": "^0.2.36",
"@types/jest": "^29.5.13",
"@types/node": "^20.12.11",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.2.25",
"jest": "^29.7.0",
"prop-types": "^15.8.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"vite": "^5.4.14",
"yalc": "^1.0.0-pre.53"
},
"engines": {
"node": ">=20"
}
} this is the package json file
12 days ago
ADMIN_CORS
*******
AUTH_CORS
*******
COOKIE_SECRET
*******
DATABASE_URL
*******
DB_NAME
*******
DISABLE_MEDUSA_ADMIN
*******
JWT_SECRET
*******
NODE_ENV
*******
PORT
*******
REDIS_URL
*******
STORE_CORS
******* these are variables from vams-medusa and from postgres below
12 days ago
# Your Medusa backend on Railway
MEDUSA_BACKEND_URL=https://vams-medusa-.....
# Admin API token from Medusa (create once with your existing script or CLI)
MEDUSA_ADMIN_API_TOKEN=pk_34e9ffea6......
MEDUSA_ADMIN_TOKEN=sk_72dbb773f.........
# For logo in Admin Panel
NEXT_PUBLIC_ADMIN_LOGO=/vams-biome-logo.png
# Simple credentials for this UI only
ADMIN_UI_EMAIL=......
ADMIN_UI_PASSWORD=,,,,, this is from the .env.local in my vams-custom-admin folder as I was not able to connect to medusa directly.
and i was creating the key using scripts in my vams-medusa folder given below import { ExecArgs } from "@medusajs/framework/types";
import { ContainerRegistrationKeys } from "@medusajs/framework/utils";
import { createApiKeysWorkflow } from "@medusajs/medusa/core-flows";
export default async function createAdminApiKey({ container }: ExecArgs) {
const logger = container.resolve(ContainerRegistrationKeys.LOGGER);
logger.info("Creating a new secret Admin API key for the custom admin UI...");
const { result: apiKeys } = await createApiKeysWorkflow(container).run({
input: {
api_keys: [
{
title: "Custom Admin UI (secret)",
type: "secret",
created_by: "script",
},
],
},
});
const adminKey = apiKeys[0];
Created admin API key (use this as MEDUSA_ADMIN_TOKEN): ${adminKey.token}
);
}
for publishable key using the script below,import { ExecArgs } from "@medusajs/framework/types";
import {
ContainerRegistrationKeys,
Modules,
} from "@medusajs/framework/utils";
import {
createApiKeysWorkflow,
linkSalesChannelsToApiKeyWorkflow,
} from "@medusajs/medusa/core-flows";
export default async function createPublishableKey({ container }: ExecArgs) {
const logger = container.resolve(ContainerRegistrationKeys.LOGGER);
const salesChannelModuleService = container.resolve(Modules.SALES_CHANNEL);
logger.info("Creating a new publishable API key for the storefront...");
const defaultSalesChannel = await salesChannelModuleService.listSalesChannels({
name: "Default Sales Channel",
});
if (!defaultSalesChannel.length) {
throw new Error(
"No 'Default Sales Channel' found. Run the main seed script once to create base data first."
);
}
const { result: publishableApiKeyResult } = await createApiKeysWorkflow(
container
).run({
input: {
api_keys: [
{
title: "Webshop (manually created)",
type: "publishable",
created_by: "script",
},
],
},
});
const publishableApiKey = publishableApiKeyResult[0];
await linkSalesChannelsToApiKeyWorkflow(container).run({
input: {
id: publishableApiKey.id,
add: [defaultSalesChannel[0].id],
},
});
Created publishable API key (use this as NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY): ${publishableApiKey.token}
);
}
11 days ago
Hey, can you show how you are reading the Redis URL in your code and a screenshot of your variables tab?
Status changed to Awaiting User Response Railway • 11 days ago
11 days ago
REDIS_URL=redis://default:UuxBpUabCPPORxKaQQqdgdXUhlGGmVkz@switchback.proxy.rlwy.net:19533?family=0
in .env in my vams-medusa folder
Status changed to Awaiting Conductor Response Railway • 11 days ago
11 days ago
Hey, first of all, I hope you didn't share your actual Redis URL, if you did, then please reset it immediately within your Redis' database credentials tab.
Second, you should use reference (environment) variables (not hardcoding any value in any .env file) and private networking to save egress. You also didn't show you are reading the variable in your code and if you have actually defined such a variable in your service's variable tab.
Status changed to Awaiting User Response Railway • 11 days ago
11 days ago
i am trying to use retool to connect to medusa on railway. and I do not have the keys and having problem creatimg it on powersell in vams-medusa folder. How can i get the keys
Attachments
Status changed to Awaiting Conductor Response Railway • 11 days ago
ymeenakpm-eng
i am trying to use retool to connect to medusa on railway. and I do not have the keys and having problem creatimg it on powersell in vams-medusa folder. How can i get the keys
11 days ago
Hey, unfortunately I can not assist with figuring out the key you need to access your service. Perhaps it is in your variables tab, hardcoded or is some kind of a default value if not set (possible, however I am not familiar with your application)?
Status changed to Awaiting User Response Railway • 11 days ago
ymeenakpm-eng
i am trying to use retool to connect to medusa on railway. and I do not have the keys and having problem creatimg it on powersell in vams-medusa folder. How can i get the keys
11 days ago
for you to generate keys, you need to login on the admin side and generate publishable keys
Status changed to Awaiting Conductor Response Railway • 11 days ago
7 days ago
i created publishable keys starting from pk_.. but still i am getting this error
Attachments
7 days ago
Could you help me debug why my Medusa v2 backend on Railway is
Returning 500
unknown_errorfor/admin/autheven with valid JSON and credentials, andReturning 401 + JSON parse errors for
/store/customerswhen called withx-publishable-api-key?
Here are my curl commands, responses, and the error lines from Deploy Logs (attached). Is there a known configuration or migration issue that would cause this? What should I change in my Railway Medusa deployment so /admin/auth and /store/customers work correctly?”
Admin auth 500
curl -i -X POST "https://vams-medusa-production.up.railway.app/admin/auth" \
-H "Content-Type: application/json" \
-d '{"email":"email_address","password":"Pwd"}' -k
Response
HTTP/1.1 500 Internal Server Error
{"code":"unknown_error","type":"unknown_error","message":"An unknown error occurred."}
Store customers 401 + JSON parse error
HTTP logs show many entries like:
path: "/store/customers"method: "POST"status: 401user_agent: "node"
Deploy logs show for POST /store/customers:
Expected property name or '}' in JSON at position 1(include the full stack trace if you can copy it)
Frontend behavior:
/api/store/auth/registerfrom Next.js sends:
POST https://vams-medusa-production.up.railway.app/store/customers
Headers:
Content-Type: application/json
x-publishable-api-key: pk_3a5d7...
Body:
{"first_name":"...","last_name":"...","email":"...","password":"..."}
But the backend returns 401 or 500.