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

auth-astro components not being found #27

Open
NachoVazquez opened this issue Apr 23, 2023 · 1 comment
Open

auth-astro components not being found #27

NachoVazquez opened this issue Apr 23, 2023 · 1 comment

Comments

@NachoVazquez
Copy link

I'm getting some errors when trying to access the SignIn and SignOut components.

The code

---
import { SignIn, SignOut } from 'auth-astro/components';
---

<section>
  <h1 class="text-h1">Login</h1>
  <SignIn provider="google" />
  <SignOut />
</section>

The errors

Server Error (running on dev): 404 /h-astro/src/components/SignIn.astro

Client Error: GET p://localhost:3000/h-astro/src/components/SignIn.astro?astro&type=script&index=0&lang.ts net::ERR_ABORTED 404 (Not Found)

The Config

import { defineConfig } from 'astro/config';
import solid from '@astrojs/solid-js';
import react from '@astrojs/react';
import partytown from '@astrojs/partytown';
import sitemap from '@astrojs/sitemap';
import tailwind from '@astrojs/tailwind';
import cloudflare from '@astrojs/cloudflare';
import Google from '@auth/core/providers/google';
import auth from 'auth-astro';
import { loadEnv } from 'vite';

const env = loadEnv('production', process.cwd(), '');

export default defineConfig({
  outDir: '...',
  integrations: [
    react(),
    solid(),
    partytown(),
    sitemap(),
    tailwind(),
    auth({
      providers: [
        Google({
          clientId: env.GOOGLE_CLIENT_ID,
          clientSecret: env.GOOGLE_CLIENT_SECRET,
        }),
      ],
    }),
  ],
  output: 'server',
  adapter: cloudflare({ mode: 'advanced' }),
});
@Benzolio
Copy link

Benzolio commented Apr 28, 2023

I've been getting the same ( from astro dev ) since I started refactoring a collection of related projects into a monorepo, with my Astro web UI now in as an npm workspace, something seems to have gone wrong with module resolution. There is no error in vscode while editing .astro pages that import the auth-astro components, but the components fail to load when running astro dev But, in my case, it builds without error, and astro preview renders the auth-astro components just fine with functioning signin and signout, no 404 errors.
It would be really great to figure out where the import resolution is breaking in astro dev, maybe an alias in the vite config could fix it.

Edit: my situation my not be related, I just noticed my server errors include a /_modules/ path prefix that does not exist, and I'm not sure where that part is coming from

[serve]    404 /_modules/auth-astro/src/components/SignIn.astro
[serve]    404 /_modules/auth-astro/src/components/SignOut.astro

But still, it's only an issue for me while running as astro dev and works fine in astro preview after astro build

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