Comments (8)
I used to have the same issue and resolved it by adding this setting to astro's config:
vite: {
optimizeDeps: { exclude: ["auth:config"] },
}
from auth-astro.
Hey, thanks for the quick answer π
I wasn't using any database adapters, in fact I was just trying to use the basic Credentials provider, with an authorize function as simple as if(credentials.password === 'password') return { id: 1 }
.
In the package's server.ts, there's this import from 'auth:config'. I get that it's nice to be able to just import the configs like this, but maybe a function for getting them would be easier to implement / use.
I was just playing arount with the tool, not using it for anything serious now, but let me know if there's any more info I can provide π
from auth-astro.
Hey!
Sorry about this. I'm guessing you're using a database adapter or something similar. Version 2 has some limitations we didn't discover until after release, but your same config should work fine in version 1.0.6
as a temporary solution (you'll have to move your config & manually define your api route, but I'm happy to help if this needs doing soon).
I'm actively working on a new version to fix these issues, but it won't be ready until later this week. I'll see if I can get the repo owner to put up some more information in the README, or see if we can push a "downgrade" of some sort while I work on implementing this new version and making sure it works this time π
from auth-astro.
Ah ok, that makes sense. With the way we currently handle the config, we're trying to pass it from the node process instance to the vite instance, so any functions started to cause problems. The new version will likely use a separate auth config file to get around the problems we're having, but I'm going to double check how it interacts with each feature of auth.js before I release anything π
from auth-astro.
I have my Astro in a monorepo, and the auth:config was failing to import, even with the patch for the separate auth.config.ts file. Something somewhere in auth-astro or astro or vite gets lost resolving from my node_modules being up a directory in the monorepo base. I used a vite.config.ts with both a cacheDir and resolver alias to get the config working (well at least this works in builds, still issues in astro dev
)
// vite.config.js
import { defineConfig } from "vite";
import path from "path";
export default defineConfig( {
cacheDir : "../node_modules/.vite",
resolve : {
alias : [{
find : "auth:config",
replacement : path.resolve( "./auth.config.ts"
)
}],
},
server : {
fs : {
allow : [".."],
},
},
} );
(edit: Removed some extraneous lines.)
from auth-astro.
A new version is finally out and this fix is included. if youΒ΄re using a version >4.0.0 please use the manual fix as @Sowce suggested.
from auth-astro.
@Sowce manual fix didn't work
$ npx astro --version
astro v4.0.7
$ npx vite --version
vite/5.0.10 darwin-arm64 node-v18.14.1
$ node --version
v18.14.1
$ npm --version
9.3.1
$ sw_vers
ProductName: macOS
ProductVersion: 13.2.1
BuildVersion: 22D68
from auth-astro.
@Sowce used the manual installation and miss to add to integration: [auth(),...]
config property on astro.config.mjs
import node from "@astrojs/node";
import { defineConfig } from 'astro/config';
import auth from "auth-astro";
import react from "@astrojs/react";
import tailwind from "@astrojs/tailwind";
// https://astro.build/config
export default defineConfig({
output: 'server',
integrations: [auth(), react(), tailwind()],
adapter: node({
mode: "standalone"
})
});
from auth-astro.
Related Issues (20)
- How to use with Cloudflare Pages env vars? HOT 7
- Add support for api context callback to auth config HOT 1
- Endpoints that should set multiple cookies only set one, causing e.g. callbackUrl to be dropped HOT 1
- Auth configuration filename hidden in README
- AstroAuth (Receiving Undefined Options) HOT 4
- Auth verification error not handled as expected HOT 3
- Make server origin configurable
- Initialize auth config lazily HOT 1
- Session cookies not changing when session is updated HOT 4
- Discord provider is missing user.id in the session object HOT 14
- Outdated @auth/core version HOT 1
- restrict users HOT 1
- AstroAuthHandler attempts to modify immutable headers HOT 4
- Sign In with Credentials Provider always return OK HOT 3
- Can't use getSession inside Vercel edge middleware
- Should support `output=hybrid` + `prerender=false`? HOT 2
- get provider source with getSession HOT 1
- Errors trying to use Keycloak as OIDC provider HOT 3
- Error on cancel login HOT 1
- I connect it with keycloak, how can I obtain the token, to consult an api if it is authenticated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auth-astro.