#✅ __MEDUSA_BACKEND_URL__ env not working

1 messages · Page 1 of 1 (latest)

winged heart
#

Hello, I am trying to get my admin instance working but it keeps connecting to localhost instead of the hostname i am trying to define. It seems as though its not using the env variable

I am really new to this and I am not sure why it is not working

Here is my .env file

COOKIE_SECRET=[redacted]
STRIPE_API_KEY=
STRIPE_WEBHOOK_SECRET=
ADMIN_CORS=https://demo-store-admin.[redacted].com
STORE_CORS=https://demo-store.[redacted].com
BACKEND_URL=https://demo-store-backend.[redacted].com
MEDUSA_BACKEND_URL=https://demo-store-backend.[redacted].com

Thank you for the support!

crimson niche
#

Your admin and backend are different environments.

#

That being said MEDUSA_BACKEND_URL won't be picked up from .env file. in the admin theme

#

Where are you hosting this?

winged heart
#

I copied the .env file to both folders, is that wrong? I am hosting it on my own server.

#

I have a Ubuntu vm for it

crimson niche
#

No, the last env var is used by admin instance. The other env vars are used by backend instance

#

You would need to have MEDUSA_BACKEND_URL be existent in node environemnt before starting the admin

#

If you're for instance using pm2 you can read pm2 docs for env vars

winged heart
#

Okay I'll try to figure that out, thank you!

crimson niche
winged heart
#

That worked, thank you