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

Adds an extension for NextAuth.js #2493

Closed

Conversation

simnalamburt
Copy link
Contributor

What's the problem this PR addresses?
NextAuth.js is not usable with Yarn 2 PnP due to wrong dependency. I tried to patch NextAuth.js first but they rejected it. So I'm fixing Next.js and Yarn instead. I already have fixed the Next.js side and this is the remaining piece.

How did you fix it?
Added an extension

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.
References

@merceyz merceyz self-requested a review February 20, 2021 17:02
I tried to patch NextAuth.js first but they rejected it. So I'm fixing
Next.js and Yarn instead. I already have fixed the Next.js side and this
is the remaining piece.

References:
  nextauthjs/next-auth#1034
  vercel/next.js#20971
Copy link
Member

@merceyz merceyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we mentioned in the linked issues it was a problem with how Next.js provided the polyfill for process so adding it as a dependency to next-auth isn't the correct fix, do you have a repro that shows that it's still needed so it can be fixed in Next.js?

I tested with https://github.com/nextauthjs/next-auth-example but can't reproduce it

@simnalamburt
Copy link
Contributor Author

simnalamburt commented Feb 20, 2021

As I stated in vercel/next.js#20971 (comment), it's not yet. It fails when you use it with Webpack 5.

How to reproduce the issue:

git clone https://github.com/simnalamburt/next-auth-example.git
cd next-auth-example
yarn
yarn dev

image

References

@JakubKoralewski
Copy link

I can't repro it either anymore. I just checked with my project in which I originally found the problem where a week ago I needed this to fix the Module not found: can't resolve 'process' error:

packageExtensions:
  next-auth@*:
    dependencies:
      process: "^0.11.10"

but now I removed it, tested it (first it failed), but after updating next-auth to "next-auth": "^3.3.0", from "next-auth": "^3.2.0-canary.35", I get an error different than Module not found: can't resolve 'process'. I think this is fixed! @simnalamburt, could you check again with latest next-auth?

@simnalamburt
Copy link
Contributor Author

The error reproduction above is using the latest version of next and next-auth.

Reference

@merceyz
Copy link
Member

merceyz commented Feb 20, 2021

It fails when you use it with Webpack 5.

Yeah that makes it a missing polyfill in Next.js, see vercel/next.js#22247 and https://github.com/vercel/next.js/blob/fea5c18132146976913f4148210b74d6d9b1ef8c/packages/next/build/webpack-config.ts#L394-L398

@merceyz merceyz closed this Feb 20, 2021
@simnalamburt
Copy link
Contributor Author

Does adding process:require.resolve('process') to the polyfill list actually solves this issue? It didn't worked for me.

Reference

@merceyz
Copy link
Member

merceyz commented Feb 20, 2021

You need to use require.resolve('process/') otherwise it will just return process again

simnalamburt added a commit to simnalamburt/next-auth-example that referenced this pull request Feb 20, 2021
@simnalamburt
Copy link
Contributor Author

Currently there's no known solution or workaround of vercel/next.js#22247, shall we reopen this PR?

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

Successfully merging this pull request may close these issues.

None yet

3 participants