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

Custom .env PORT being ignored? #2880

Closed
ThorANilsson opened this issue Aug 13, 2024 · 2 comments
Closed

Custom .env PORT being ignored? #2880

ThorANilsson opened this issue Aug 13, 2024 · 2 comments
Labels
bug Something isn't working fixed in dev Fixed in the dev branch

Comments

@ThorANilsson
Copy link

ThorANilsson commented Aug 13, 2024

Describe the Bug

I have the following .env file in the root of the Umami directory:

DATABASE_URL=url
PORT=3001

Upon building the application, Umami successfully reads the DATABASE_URL from .env. But when starting the application using start-env, the application appears to pick a random port number instead of the provided one? For example 43319 instead of 3001.

Even going into the start script start-env.js and manually changing the port to 3001, it still picks a random one when starting.

Database

PostgreSQL

Which Umami version are you using? (if relevant)

2.12.1

@franciscao633 franciscao633 added bug Something isn't working fixed in dev Fixed in the dev branch labels Aug 15, 2024
@franciscao633
Copy link
Collaborator

Thanks for catching this. Can you change the start-env.js script to the below to fix.

require('dotenv').config();
const cli = require('next/dist/cli/next-start');

cli.nextStart({
  port: process.env.PORT || 3000,
  hostname: process.env.HOSTNAME || '0.0.0.0',
});

@ThorANilsson
Copy link
Author

Thanks for catching this. Can you change the start-env.js script to the below to fix.

require('dotenv').config();
const cli = require('next/dist/cli/next-start');

cli.nextStart({
  port: process.env.PORT || 3000,
  hostname: process.env.HOSTNAME || '0.0.0.0',
});

That seems to work! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in dev Fixed in the dev branch
Projects
None yet
Development

No branches or pull requests

2 participants