It seems that nextjs attempts to fetch data using incorrect IP. Namely ::1 even though the the .env is setup like so:
NEXT_PUBLIC_SALEOR_API_URL=http://192.168.64.8:8000/graphql/
# make sure to add it on production for correct canonical URLs
NEXT_PUBLIC_STOREFRONT_URL=http://localhost:3000
ENABLE_SSL=False
# Token used for fetching channels
SALEOR_APP_TOKEN=
the error message after "docker compose up"
Both saleor platform and storefront are on the same network. I do not seem to understand why this is happening.
A very very dirty fix is to edit /etc/hosts in the docker container to resolve localhost to the 192.168.64.8. Of course, this is not sustainable.
Dues anyone know where use of the API_URL can be enforced?
This is the error log snippet when accessing localhost:3000 storefront:
Summary
It seems that nextjs attempts to fetch data using incorrect IP. Namely ::1 even though the the .env is setup like so:
the error message after "docker compose up"
Both saleor platform and storefront are on the same network. I do not seem to understand why this is happening. A very very dirty fix is to edit /etc/hosts in the docker container to resolve localhost to the 192.168.64.8. Of course, this is not sustainable.
Dues anyone know where use of the API_URL can be enforced?
This is the error log snippet when accessing localhost:3000 storefront:
Steps to reproduce
How I build the docker container:
follow the instruction on https://github.com/saleor/saleor-platform to get the api up and running
docker build --network host -t storefront-saleor-storefront:latest --build-arg NEXT_PUBLIC_SALEOR_API_URL=http://192.168.64.8:8000/graphql/ --build-arg NEXT_PUBLIC_STOREFRONT_URL=http://192.168.64.9:3000 --build-arg ENABLE_SSL=False --build-arg DEBUG=True .
docker compose up
storefront container will not be able to fetch data from the api
p.s the step 1. is a workaround so that during build the network is accessible. Building using docker compose does not work.
A link to a reproduction repository
No response
Output from envinfo
pnpm --version -> is unavailable after docker build ...
npx envinfo --system --binaries --browsers --markdown -> it seems to hand and never return inside docker container