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

NEXT_PUBLIC_BASE_URL needs to be loaded after build #43

Closed
diegonicacio opened this issue Apr 9, 2023 · 1 comment
Closed

NEXT_PUBLIC_BASE_URL needs to be loaded after build #43

diegonicacio opened this issue Apr 9, 2023 · 1 comment

Comments

@diegonicacio
Copy link
Contributor

diegonicacio commented Apr 9, 2023

This means that the application has to be built with the NEXT_PUBLIC_BASE_URL already set, instead of allowing it to be filled later.
Such practice, prevents users from using the already built application (being it inside/outside of docker).

How to reproduce:

1 - Make sure you're working on a clean environment (identical to repo)

git clean -fdxd

2 - Build the application

npm install
npm run build

3 - Create your .env.local file with the your configs (firebase and public url)

cat >> .env.local << EOF

NEXT_PUBLIC_BASE_URL="http://127.0.0.1.xip.io:3000/"

RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false
SECRET_KEY=""
STORAGE_BUCKET="blablabla.appspot.com"
PROJECT_ID="blablabla"
AUTH_DOMAIN="balblabla.firebaseapp.com"
MEASUREMENT_ID="G-BLABLABLA"
APP_ID="9:999999999999:web:9a9a9a9a9a9a9a9a9a9a"
MESSAGING_SENDER_ID="999999999999"
API_KEY="asdadasdasdsadasd_asdasdasdasd-123asd123"
EOF

4 - Start the application

npm run start

Expected

1 - Navigate to http://127.0.0.1.nip.io:3000/
2 - Open preferred Developer tools and go to the network tab
3 - Fill in any URL on the webpage and click on the button Light It Up 🔥
4 - A POST request is shown on the network tab aimed at http://127.0.0.1.xip.io:3000/

Actual

1 - Navigate to http://127.0.0.1.nip.io:3000/
2 - Open preferred Developer tools and go to the network tab
3 - Fill in any URL on the webpage and click on the button Light It Up 🔥
4 - A POST request is shown on the network tab aimed at http://localhost:3000/

Temporary workaround

While this issue doesn't get fixed, might be worth it to change documentation to:

Application

Instruct users to build application with the .env.local already created and filled as first step.

Docker

Stop distributing ready-to-use docker image and change docker-compose to force user to build its own docker-image

@NayamAmarshe
Copy link
Owner

Disabled docker CI.

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

No branches or pull requests

2 participants