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

Add argon2 compatibility with vercel #183

Closed
nohren opened this issue Apr 9, 2021 · 7 comments · Fixed by #195
Closed

Add argon2 compatibility with vercel #183

nohren opened this issue Apr 9, 2021 · 7 comments · Fixed by #195
Labels
bug Something isn't working

Comments

@nohren
Copy link

nohren commented Apr 9, 2021

Using argon2@0.27.2

Depoying this to vercel gives a an error in the serverless function tab saying cannot find or reference node module argon 2.

https://vercel.com/support/articles/why-does-my-serverless-function-work-locally-but-not-when-deployed.
Based off this article, I believe the issue is due to argon2 native node-gyp requiring libraries. And it seems vercel cannot support native to node / node to native compiling.

Only solution I see is if argon2 authors create an argon2js or javascript version with 0 dependencies like bcryptjs or vercel changes something about their network but me thinks vercel cannot do that by design with this serverless architecture.

Argon2 is the best open source cryptography available for those wanting to manually hash their own passwords. And vercel network is the best for rapid development and hands free deployment. It would be great if they could get along.

@guybedford
Copy link
Contributor

@nohren can you share a direct replication of the issue? Is it as simple as require('argon2') not working or does it require a code example to demonstrate the problem?

@nohren
Copy link
Author

nohren commented Apr 11, 2021

It is as simple as require('argon2')

@styfle
Copy link
Member

styfle commented May 8, 2021

Thanks, I was able to reproduce.

Error: Cannot find module './dist/node_modules/argon2/lib/binding/napi-v3/argon2.node'
Require stack:
  ./dist/node_modules/argon2/argon2.js
  ./dist/index.js

We had a special case for argon2 but looks like the directory changed

'argon2' ({ id, emitAssetDirectory }) {
if (id.endsWith('argon2/argon2.js')) {
emitAssetDirectory(resolve(dirname(id), 'build', 'Release'));
emitAssetDirectory(resolve(dirname(id), 'prebuilds'));
}
},

@styfle styfle added the bug Something isn't working label May 8, 2021
@styfle
Copy link
Member

styfle commented May 10, 2021

Fixed in the latest nft and will be fixed for node deployments here: vercel/vercel#6211

@augustl
Copy link

augustl commented Apr 26, 2024

FYI, this is broken again now, as the main index file is now called argon2/argon2.cjs in 0.40.x.

Is there any way to add our own manual exclusions and handling of dependencies in our projects? My workaround at the moment is to use an older version, 0.31.x, where the file is called argon2.js and not argon2.cjs :)

@styfle
Copy link
Member

styfle commented Apr 26, 2024

Feel free to create a PR and I'll take a look

@henokyehulu

This comment was marked as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants