Open srkuleo opened 4 months ago
Using "oslo": "^1.2.1"
the same issue occurs with a standard Node.js server bundled using tsup to generate ESM.
tsup.config.ts
import { defineConfig } from "tsup";
export default defineConfig({
entry: ["src/index.ts"],
clean: true,
format: "esm",
noExternal: [
"@shift-desk/constants",
"@shift-desk/database",
"@shift-desk/importer",
"@shift-desk/types",
],
esbuildOptions: (options) => {
options.external?.push("@node-rs/argon2", "@node-rs/bcrypt");
return options;
},
tsconfig: "tsconfig.json",
});
output
CLI Building entry: src/index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v8.2.3
CLI Using tsup config: /path/apps/server/tsup.config.ts
CLI Target: es2022
CLI Cleaning output folder
ESM Build start
ESM dist/index.js 211.87 KB
ESM ⚡️ Build success in 39ms
cache bypass, force executing bdfbbfffe9f3ce47
> @shift-desk/server@0.0.0 preview /path/apps/server
> node ./dist/index.js
file:///path/apps/server/dist/index.js:11
throw Error('Dynamic require of "' + x + '" is not supported');
^
Error: Dynamic require of "assert" is not supported
at file:///path/apps/server/dist/index.js:11:9
at ../../node_modules/.pnpm/argon2@0.40.3/node_modules/argon2/argon2.cjs (file:///path/apps/server/dist/index.js:380:18)
at __require2 (file:///path/apps/server/dist/index.js:14:50)
at file:///path/apps/server/dist/index.js:5727:22
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
Node.js v20.15.0
ELIFECYCLE Command failed with exit code 1.
ERROR: command finished with error: command (/Users/max.schmidt/progg/shiftdesk/apps/server) /Users/max.schmidt/.nvm/versions/node/v20.15.0/bin/pnpm run preview exited (1)
I am running into a similar issue with both Argon2
and Bcrypt
when bundling with rollup (on a sveltekit project) here is the full error
error during build:
[commonjs--resolver] ../../node_modules/.pnpm/@node-rs+bcrypt-darwin-arm64@1.9.0/node_modules/@node-rs/bcrypt-darwin-arm64/bcrypt.darwin-arm64.node (1:0): Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)
file: /Users/isaac/Desktop/projects/project/node_modules/.pnpm/@node-rs+bcrypt@1.9.0/node_modules/@node-rs/bcrypt/index.js:1:0
1: ����
���__TEXT�__text...
^
2: �H__LINKEDIT@
�/Users/runner/work/node-rs/node-rs/target/aarch6...
It seems like an issue with the rust solutions, we probably need a pure js solution (even though it's slow) in order to get around bundlers
@isaacfink were you able to find a solution for SvelteKit?
We really need this. Deployments on SST V3 also break. Very annoying!
I am running into a similar issue with both
Argon2
andBcrypt
when bundling with rollup (on a sveltekit project) here is the full errorerror during build: [commonjs--resolver] ../../node_modules/.pnpm/@node-rs+bcrypt-darwin-arm64@1.9.0/node_modules/@node-rs/bcrypt-darwin-arm64/bcrypt.darwin-arm64.node (1:0): Unexpected character '�' (Note that you need plugins to import files that are not JavaScript) file: /Users/isaac/Desktop/projects/project/node_modules/.pnpm/@node-rs+bcrypt@1.9.0/node_modules/@node-rs/bcrypt/index.js:1:0 1: ���� ���__TEXT�__text... ^ 2: �H__LINKEDIT@ �/Users/runner/work/node-rs/node-rs/target/aarch6...
It seems like an issue with the rust solutions, we probably need a pure js solution (even though it's slow) in order to get around bundlers
+1
Having problems during my SST V3 deployments. Vercel works, but I don't want to host there. So If there is no solution, dropping Lucia/Oslo is the only option.
Same here.
Luckily scrypt is in node:crypto
, but Argon2Id isn't 👀
Current version: 14.2.4
I've set up a pretty basic username/password auth. Page renders client side form, which calls upon client action inside which server action is awaited and based on what action return value is different UI is rendered (errors, confirmation toast, loading state, etc.).
Form code:
Action code:
Essentially it throws this error when trying to hash the password via Argon2id class, or any other class provided by oslo/password (Bcrypt or Scrypt).
I have done few things to try to fix this like adding "@node-rs/argon2" as separate dependency and modifying next.config.js to look like this
but none of these solutions helped. Switching to Bcrypt as standalone dependency fixes the issue, but I would like to use Argon and would like to follow recommended Lucia setup.
Looking forward to your response and if you need anything else feel free to ask!