-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix: remove reference to env variables on frontend #4
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
app/env.ts
Outdated
PROFILE_URL: process.env.PROFILE_URL || "https://lens.k3l.io", | ||
CONTENT_URL: process.env.CONTENT_URL || "https://content.lens.k3l.io", | ||
PROFILE_URL: "https://lens.k3l.io", | ||
CONTENT_URL: "https://content.lens.k3l.io", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the problem is in Vercel and may not be in the code. According to this doc - Declare an Environment Variable using process.env seems to be the right way to go. Can you please confirm this ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the problem is that we are trying to load the environment variables on the client component not server rendered component. The client side component that has useEffect
can only be referenced from client, and we are calling this call from the client.
I've checked the environment variables, and we already have them imported on Vercel.
I'm not too familiar with Remix, and let me investigate how they work on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, that's why i was thinking a better fix would be to move the call to getEnv into the export default function HeaderLinks()
function in HeaderLinks.tsx and into export default function Index()
in the index.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think HeaderLinks
and Index
are still a client component, and the proper way to solve this problem is to shove it into window like this link. https://remix.run/docs/en/main/guides/envvars#browser-environment-variables
901383b
to
3f641ec
Compare
https://www.notion.so/karma3labs/Broken-lens-k3l-io-Env-remix-variable-breaks-js-fe800d512bcd4dfcb7c048577532c501?pvs=4