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

secure-password deps not usable #4354

Open
gengjiawen opened this issue Jul 2, 2024 · 6 comments
Open

secure-password deps not usable #4354

gengjiawen opened this issue Jul 2, 2024 · 6 comments
Labels
kind/bug Something isn't working status/triage

Comments

@gengjiawen
Copy link
Contributor

What is the problem?

not working on node.js

Paste all your error logs here:

Error: No native build was found for platform=darwin arch=x64 runtime=node abi=115 uv=1 libc=glibc node=20.13.0
    loaded from: /private/tmp/blitz14-demo/[project]/node_modules/.pnpm/[email protected]/node_modules/sodium-native/index.js [app-ssr] (ecmascript)

Paste all relevant code snippets here:

PASTE_HERE (leave the ``` marks)

What are detailed steps to reproduce this?

new blitz project

Run blitz -v and paste the output here:

macOS Sonoma | darwin-x64 | Node: v20.13.0


 Package manager: pnpm

  System:
    OS: macOS 14.5
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 1.38 GB / 32.00 GB
    Shell: 3.7.1 - /usr/local/bin/fish
  Binaries:
    Node: 20.13.0 - /usr/local/bin/node
    Yarn: 1.22.22 - ~/Library/pnpm/yarn
    npm: 10.5.2 - /usr/local/bin/npm
  npmPackages:
    @blitzjs/auth: 2.0.10 => 2.0.10 
    @blitzjs/next: 2.0.10 => 2.0.10 
    @blitzjs/rpc: 2.0.10 => 2.0.10 
    @prisma/client: 5.4.2 => 5.4.2 
    blitz: 2.0.10 => 2.0.10 
    next: 14.2.4 => 14.2.4 
    prisma: 5.4.2 => 5.4.2 
    react: 18.2.0 => 18.2.0 
    react-dom: 18.2.0 => 18.2.0 
    typescript: ^4.8.4 => 4.9.5 

Please include below any other applicable logs and screenshots that show your problem:

Maybe remove secure-password dep, switch to argon2 or use bcrypt.

@gengjiawen
Copy link
Contributor Author

@siddhsuresh

@gengjiawen

This comment was marked as outdated.

@siddhsuresh
Copy link
Member

siddhsuresh commented Oct 8, 2024

thanks for you work on this @gengjiawen, this is an issue caused when next.js packs the dependencies in a way sodium-native is not able to find its pre built binary files.

We had tried to handle it here

const sodiumNativePath = fs.realpathSync(
path.join(require.resolve("sodium-native"), ".."),
)
const dotNextDirectory = `${process.cwd()}/.next`
config.plugins.push(
new CopyPlugin({
patterns: [
{
//dev
from: `${sodiumNativePath}/prebuilds/`,
to: `${dotNextDirectory}/server/vendor-chunks/prebuilds/`,
},
{
//prod
from: `${sodiumNativePath}/prebuilds/`,
to: `${dotNextDirectory}/server/chunks/prebuilds/`,
},
],
}),
)
} catch {}
}
.

looks like maybe the latest next.js versions has broken this fix

@gengjiawen
Copy link
Contributor Author

gengjiawen commented Oct 21, 2024

The required actual dir is /workspace/ai/.next/server/app/(auth)/login

Maybe copied to the wrong location or lack of fallback. Also cc @timneutkens

Currently you can do this to hack the runtime error

cp -r ./node_modules/.pnpm/[email protected]/node_modules/sodium-native/prebuilds .next/server/app/(auth)/login

@gengjiawen
Copy link
Contributor Author

gengjiawen commented Nov 1, 2024

This make production login not usable on node.js 22.

@gengjiawen
Copy link
Contributor Author

for latest blitzjs

cp -r ./node_modules/.pnpm/[email protected]/node_modules/sodium-native/prebuilds ".next/server/app/api/rpc/[[...blitz]]"

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

No branches or pull requests

2 participants