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

fix: NEXT_PUBLIC variable access #94

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/env-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const WORKOS_COOKIE_DOMAIN = getEnvVariable('WORKOS_COOKIE_DOMAIN');
const WORKOS_COOKIE_MAX_AGE = getEnvVariable('WORKOS_COOKIE_MAX_AGE');
const WORKOS_COOKIE_NAME = getEnvVariable('WORKOS_COOKIE_NAME');
const WORKOS_COOKIE_PASSWORD = getEnvVariable('WORKOS_COOKIE_PASSWORD') ?? '';
const WORKOS_REDIRECT_URI = getEnvVariable('NEXT_PUBLIC_WORKOS_REDIRECT_URI') ?? '';
const WORKOS_REDIRECT_URI = process.env.NEXT_PUBLIC_WORKOS_REDIRECT_URI ?? '';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is baffling, I wonder why process.env[name] isn't working as expected. Since getEnvVariable doesn't add much anymore, would you mind replacing every instance in this file with a direct lookup of process.env? e.g.

Suggested change
const WORKOS_REDIRECT_URI = process.env.NEXT_PUBLIC_WORKOS_REDIRECT_URI ?? '';
const WORKOS_API_HOSTNAME = process.env..WORKOS_API_HOSTNAME;
const WORKOS_API_HTTPS = process.env.WORKOS_API_HTTPS;
const WORKOS_API_KEY = process.env.WORKOS_API_KEY ?? '';
const WORKOS_API_PORT = process.env.WORKOS_API_PORT;
const WORKOS_CLIENT_ID = process.env.WORKOS_CLIENT_ID ?? '';
const WORKOS_COOKIE_DOMAIN = process.env.WORKOS_COOKIE_DOMAIN;
const WORKOS_COOKIE_MAX_AGE = process.env.WORKOS_COOKIE_MAX_AGE;
const WORKOS_COOKIE_NAME = process.env.WORKOS_COOKIE_NAME;
const WORKOS_COOKIE_PASSWORD = process.env.WORKOS_COOKIE_PASSWORD ?? '';
const WORKOS_REDIRECT_URI = process.env.NEXT_PUBLIC_WORKOS_REDIRECT_URI ?? '';

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't see the nextjs docs you linked, makes sense now. Thanks for catching!


export {
WORKOS_API_HOSTNAME,
Expand Down