rallly
rallly copied to clipboard
Use runtime environment values on client
When we build the docker image for Rallly, values like NEXT_PUBLIC_BASE_URL
are set during build time for client side code and do not match what is expected during runtime. We can use next-runtime-env to get the runtime value of these environment variables.
Came here to report that the app kept redirecting to localhost:3000 and this is probably the reason then. The Cloudron package is built without a final domain, as it is not known yet. Guess we have to wait for a package update then for this to be added.
@nebulade, is this a new issue in 3.2.0
?
hm I see this issue is much older. Well it was detected by our tests, so I started investigation. Maybe then it is related to https://github.com/lukevella/rallly/commit/703d551aac7647b46039a05fd06662bec0d758a9 ?
I don't think it's likely to be that. Do you know what the last working version was?
Last working version was 3.1.0 so possibly then I am chasing the wrong thing. I see that the process.env.
usage was always like that so always during the build?
Maybe should split this into a new issue then. Also we had to apply the same fix exporting HOSTNAME
as we had to for https://github.com/baptisteArno/typebot.io/issues/911#issuecomment-1761210931 possibly then some nextjs update making the difference
I suspect there is some way to fix this but I'd need some steps to be able to reproduce it. Are you able to provide that?
Tried to get the app working locally to reproduce the issue, but didn't succeed to get it working at all there. So I went to bisect it via a Cloudron build package. For reference its build like this: https://git.cloudron.io/cloudron/rallly-app/-/blob/main/Dockerfile?ref_type=heads The env variables we set during runtime (so after the build) are https://git.cloudron.io/cloudron/rallly-app/-/blob/main/start.sh?ref_type=heads#L26 and that worked before.
So the commit causing the issue after bisecting is 6fa66da6818ef7a41b6f7ff9fdebff36312934e4 which causes a redirect to http://localhost:3000 after initial loading. Will see if I can drill down further to this issue, but any help is much appreciated.
Ah right that makes sense. You will need to set NEXTAUTH_URL
as well to the same value as NEXT_PUBLIC_BASE_URL
. Annoyingly this env var is required by next-auth. I didn't want to expose this since it is an implementation detail so it is handled in the start script here: https://github.com/lukevella/rallly/blob/main/scripts/docker-start.sh#L4
I'll try to change how this is handled so that it doesn't require you to add NEXTAUTH_URL
as well though but for now that could be a quick fix.
Ah right, should have seen that start script change earlier. Have triggered a new test run with it now, so if that works its fine, no need to change this in the code then.
I can confirm it works with NEXTAUTH_URL
also set now. Thanks a lot for your help and sorry for highjacking this, now unrelated issue :/