[bug] the new ozone (bluesky-social/ozone) is not configurable, by the web front-end ignoring all environment variables. #2412
Replies: 1 comment 4 replies
-
After some investigation and debugging, I finally found that this issue was caused by a mismatch between the use of NEXT_PUBLIC_XXX env vars and its aims(flexibility on deployment). as described below in next.js official document, NEXT_PUBLIC_XXX is frozen at build time, so it's cannot use for URL endpoint which should be flexible to deployment.
While investigating work around, I found below page which describes choices to support runtime configuring next.js front-end. I think below choice is simple and the best, because server side( REST server) detects runtime env vars as we expected.
to achieve this choice, it just needs:
before making code, I'd like to confirm if maintainers agree the above choice. or let me know preferable alternative for maintainers. |
Beta Was this translation helpful? Give feedback.
-
related to #2404 and bluesky-social/ozone#94 and migrated here from those.
introduction
the new ozone (https://github.com/bluesky-social/ozone) provides the next.js-based web front-end with atproto/packages/ozone as backend and the REST server.
next.js provides the way to configure front-end by environment variables prefixed NEXT_PUBLIC_.
the code in new ozone trying to follow the above mechanism to tune web front-end behavior by involving NEXT_PUBLIC_PLC_DIRECTORY_URL besides OZONE_DID_PLC_URL for PLC endpoint, and so on.
as I reported in bluesky-social/ozone#94,
expected behavior:
when NEXT_PUBLIC_PLC_DIRECTORY_URL is configured, its value is used to change PLC endpoint from default. and other environment variables also work respectively.
actual behavior
all environment variables are ignored by front-end, then it does not work as expected.
for example, even I set both NEXT_PUBLIC_PLC_DIRECTORY_URL and OZONE_DID_PLC_URL to my-own PLC,
front-end keeps accessing its hard-coded default value, then sign-in process failed in front-end, and ozone doesn't work on my deployment.
remarkable things is:
the REST server (express) recognizes the all environment variables including NEXT_PUBLIC_PLC_DIRECTORY_URL and OZONE_DID_PLC_URL as expected.
so I guess environment variables are lost in somewhere while front-end booting process.
Beta Was this translation helpful? Give feedback.
All reactions