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

Resolved: auth-astro Dependency Conflict by Upgrading @auth/core #2

Open
MaestroMiyagi opened this issue Jul 24, 2024 · 1 comment
Open

Comments

@MaestroMiyagi
Copy link

Describe the bug

When installing dependencies for an Astro project using [email protected], I encountered an error due to a peer dependency conflict with @auth/core. The project used an older version of @auth/core (0.18.6), while auth-astro required at least version 0.32.0.

To Reproduce

  1. Create a new Astro project using the Starlight Auth template:
npm create astro@latest -- --template TheOtterlord/starlight-auth
  1. In the prompt, select yes when asked to install the dependencies
  2. It should give you the next error
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: @auth/[email protected]
npm error node_modules/@auth/core
npm error   @auth/core@"^0.18.6" from the root project
npm error
npm error Could not resolve dependency:
npm error peer @auth/core@"^0.32.0" from [email protected]
npm error node_modules/auth-astro
npm error   auth-astro@"^4.1.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error

How to fix it

  1. Create a new Astro project using the Starlight Auth template:
npm create astro@latest -- --template TheOtterlord/starlight-auth
  1. In the prompt, select no when asked to install the dependencies

  2. Upgrade @auth/core to a compatible version:

   npm install @auth/core@^0.32.0

Expected behavior

Dependencies should install without errors after upgrading @auth/core.

I hope this helps anyone having this problem

Additional context

Astro version: 4.5.17
Node.js version: v22.5.1
Operating system: Ubuntu 22.04.4 LTS

@arnoan
Copy link

arnoan commented Oct 21, 2024

@MaestroMiyagi
Thank you for creating this issue and also documenting the fix.
I initially encountered the same error, and now also got the template running with the updated version of @auth/core

I tried a proof of concept with GitHub OAuth provider and managed to get the login & logout working as intended. However the pages of the starlight documentation don't seem to be affected by the login state as represented by the session object.

The logic in src/lib/auth.ts doesn't seem to take effect. So even without being logged in/authenticated I can access the example doc pages that should be protected.

Did you eventually get the core functionality of protecting starlight pages to work as intended?

@TheOtterlord
Is this project still maintained/functional or is it possible that with newer versions of the Astro dependencies your initial logic got broken? As it stands right now, I haven't been able to make my envisioned setup work (protect individual pages/routes in a Starlight docs site).

Thank you for building and sharing this template. I would be grateful for a quick indication whether this is still maintained/intended to work, or any other pointers you might have.

Many thanks,
Arno

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants