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

Can't find withMiddlewareAuthRequired #988

Closed
7 tasks done
xjustleoo opened this issue Jan 6, 2023 · 2 comments · Fixed by #1019
Closed
7 tasks done

Can't find withMiddlewareAuthRequired #988

xjustleoo opened this issue Jan 6, 2023 · 2 comments · Fixed by #1019
Labels
question Further information is requested

Comments

@xjustleoo
Copy link

Checklist

  • The issue can be reproduced in the sample app (or N/A).
  • I have looked into the README and have not found a suitable solution or answer.
  • I have looked into the examples and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

`
import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/middleware';

export default withMiddlewareAuthRequired();

export const config = {
matcher: '/user/:path*',
}`

I'm trying import the "withMiddlewareAuthRequired" function but get "Cannot find module '@auth0/nextjs-auth0/middleware' or its corresponding type declarations."

Reproduction

  1. Install newest version of auth0 next js
  2. Create middleware.ts
  3. Paste
    `import { withMiddlewareAuthRequired } from '@auth0/nextjs-auth0/middleware';

export default withMiddlewareAuthRequired();`

SDK version

2.0.1

Next.js version

13.0.0

Node.js version

16

@adamjmcgrath
Copy link
Contributor

Hi @xjustleoo - thanks for raising this,

You need to import it from @auth0/nextjs-auth0/edge (see https://github.com/auth0/nextjs-auth0#edge-for-middleware-and-the-edge-runtime)

Let me know if there's some out of date documentation somewhere

@adamjmcgrath adamjmcgrath added the question Further information is requested label Jan 6, 2023
@adamjmcgrath
Copy link
Contributor

Closing as I believe #988 (comment) answers your question

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

Successfully merging a pull request may close this issue.

2 participants