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

Nxut3. Don`t work originEnvKey when ssr: false in nuxt.config #991

Open
Islam260301 opened this issue Jan 24, 2025 · 1 comment
Open

Nxut3. Don`t work originEnvKey when ssr: false in nuxt.config #991

Islam260301 opened this issue Jan 24, 2025 · 1 comment
Labels
bug A bug that needs to be resolved pending An issue waiting for triage

Comments

@Islam260301
Copy link

Environment

I use:

  • nuxt3 @3.5.3
  • Typescript
  • @sidebase/nuxt-auth @0.9.4

runtimeConfig: { public: { apiBaseUrl: process.env.NUXT_PUBLIC_API_BASE_URL, }, { auth: { originEnvKey: 'NUXT_PUBLIC_API_BASE_URL', provider: { type: 'local', // another configs } } } }

Reproduction

runtimeConfig: { public: { apiBaseUrl: process.env.NUXT_PUBLIC_API_BASE_URL, }, { auth: { originEnvKey: 'NUXT_PUBLIC_API_BASE_URL', provider: { type: 'local', // another configs } } } }

Describe the bug

Nxut3. Dont work originEnvKey when ssr: false in nuxt.config. Because originEnvKey used just at getServerOrigin function, which in node_modules/@sidebase/nuxt-auth/dist/runtime/server/services/utils.js. There used useRuntimeConfig(). But we dont have access to config[normalized], because in client at config not private variables from .env.

My solution is possible. Add a condition "envVariableName.startsWith(NUXT_PUBLIC_)"

Additional context

No response

Logs

@Islam260301 Islam260301 added bug A bug that needs to be resolved pending An issue waiting for triage labels Jan 24, 2025
@Islam260301
Copy link
Author

Solution with baseURL: process.env.NUXT_PUBLIC_API_BASE_URL+ "/api/auth", not for me. Because I provide env vars in runtime (in start app). At build I don`t have them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that needs to be resolved pending An issue waiting for triage
Projects
None yet
Development

No branches or pull requests

1 participant