nextauthjs / nextauthjs/next-auth

auth.js tries to import $env/dynamic/private in SvelteKit frontend

Open
#11,166 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug svelte triage
Dominant language
TypeScript
Stars
28.4k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

Environment
 System:
    OS: macOS 15.0
    CPU: (8) arm64 Apple M2
    Memory: 103.59 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - /usr/local/bin/node
    Yarn: 1.22.21 - /usr/local/bin/yarn
    npm: 10.5.1 - /usr/local/bin/npm
    pnpm: 9.0.3 - /usr/local/bin/pnpm
    bun: 1.1.12 - ~/.bun/bin/bun
  Browsers:
    Chrome: 126.0.6478.61
    Safari: 18.0
  npmPackages:
    @auth/sveltekit: ^1.2.0 => 1.2.0 
Reproduction URL

https://github.com/ssebastianoo/SelfStats/blob/authjs-bug/src/routes/signin/%2Bpage.svelte

Describe the issue

When trying to set up a custom sign in page the authjs library for SvelteKit tries, for some reason, to import { env } from "$env/dynamic/private"; in the client, breaking the whole app

image

image

How to reproduce

Add a custom login page following the docs

Expected behavior

$env/dynamic/private shouldn't be imported on the client

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked reproduction URL and the custom sign-in page described in the issue, then trace how the client-side page imports the Auth.js SvelteKit package. Confirm that the private environment module is not included in the client bundle, and use the reproduction to verify the app loads successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
authentication, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.