Giter VIP home page Giter VIP logo

Comments (8)

Sowce avatar Sowce commented on July 17, 2024 9

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.

detarkende avatar detarkende commented on July 17, 2024 1

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.

TheOtterlord avatar TheOtterlord commented on July 17, 2024

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.

TheOtterlord avatar TheOtterlord commented on July 17, 2024

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.

Benzolio avatar Benzolio commented on July 17, 2024

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.

nowaythatworked avatar nowaythatworked commented on July 17, 2024

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.

gustavorps avatar gustavorps commented on July 17, 2024

@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.

gustavorps avatar gustavorps commented on July 17, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.